Readable matrix code

ABSTRACT

A method of generating a readable matrix code image encoding a message based on an input image and a readable matrix coding specification, comprising: calculating function areas readable to comply with a function patterns specification; determining an extent of free cells and derived cells according to a code word specification; calculating decode input values for free cells such that the appearance of the free cells compared to respective areas of the input image complies with a visual perceptual similarity criterion and with the code word specification; and calculating decode input values for derived cells based on the free cells decode input values and in compliance with the code word specification.

CROSS-REFERENCE TO RELATED APPLICATIONS

This is a continuation of U.S. patent application Ser. No. 14/116,317,filed Nov. 7, 2013, which is a 371 of PCT/IL2012/050410, filed Oct. 16,2012, which claims priority of U.S. Provisional Patent Application No.61/601,042, filed Feb. 21, 2012.

FIELD OF THE INVENTION

The present invention is in the field of readable matrix code.

BACKGROUND

One common matrix code is the Quick Response (“QR”) Code. QR Code is aregistered trademark of Denso Wave of Chita-gun Aichi, Japan. Anothercommon matrix code is the EZcode created by ETH of Zurich, Switzerland,and was exclusively licensed to Scanbuy in 2006 of New York, N.Y.

U.S. Pat. No. 8,144,922 to Kawabe et al discloses a two-dimensional codewith a logo, wherein a two-dimensional code that represents informationby means of a cell dot distribution pattern formed by having a pluralityof cells colored and a logo mark visually representing characters aresuperimposed. In a preferred embodiment, at least a part of the cell dotcolor area is smaller than the cell area while the two-dimensional codethat represents the information by means of the cell dot distributionpattern that color codes the cells and the logo mark that visuallyrepresents the character are superimposed.

US Patent Publication 2009/0255992 to Shen discloses a system forsynthesizing a two dimensional code and a logo. The system forgenerating a synthesized two dimensional code comprises synthesizingmeans, for synthesizing an original two dimensional code and a visuallyreadable logo to form the synthesized two dimensional code, with atleast a part of the visually readable logo being overlapped with theoriginal two dimensional code; identifying means, for reading andidentifying the synthesized two dimensional code; and adjusting means,if the synthesized two dimensional code being identified by theidentifying means has a code error rate of the synthesized twodimensional code larger than an error correction rate, the adjustingmeans adjusting the size of the visually readable logo and/or thelocation of the visually readable logo with respect to the original twodimensional code. According to Shen the proposed invention can be usedto integrate enterprise logo(s), brand logo(s) and product logo(s) witha two dimensional code as a whole, which may save areas and achievebetter effect for brand and product promotion.

US Patent Publication 2009/0057420 to Onoda et al discloses a cleartwo-dimensional code which can be merged with an image without giving auser a feeling of disorder when the clear two-dimensional code isattached to the image and in which a readable situation and the like canbe arbitrarily set; an article having the clear two-dimensional codeattached thereto; a method for printing the two-dimensional code; and amethod for displaying the two-dimensional code. Base cells and datacells are arranged in a matrix, and either the base cells or the datacells are clear. The clear two-dimensional code can be read only when acolor shown on the clear cells consisting of either the base cells orthe data cells and a color shown or non-clear cells consisting of eitherthe base cells or the data cells have a contrast which can be read by acode recognition apparatus

designQR® by IT DeSign Inc of Springdale, Ark. offers its users torender a logo or a simple symbol onto a QR Code. According to ITDeSign's web-site (http://www.desgin-it.com/), the designQR® technologysearches for the best position in a given QR Code for positioning a logoor symbol over the QR Code. Further according to the web-site, the bestposition for a logo, is where the dots cell distribution of the said QRCode best resembles the logo in respect to the value read by thecorresponding optical reader.

SUMMARY OF THE INVENTION

Many of the functional components of the presently disclosed subjectmatter can be implemented in various forms, for example, as hardwarecircuits comprising custom VLSI circuits or gate arrays, or the like, asprogrammable hardware devices such as FPGAs or the like, or as asoftware program code stored on an intangible computer readable mediumand executable by various processors, and any combination thereof. Aspecific component of the presently disclosed subject matter can beformed by one particular segment of software code, or by a plurality ofsegments, which can be joined together and collectively act or behaveaccording to the presently disclosed limitations attributed to therespective component. For example, the component can be distributed overseveral code segments such as objects, procedures, and functions, andcan originate from several programs or program files which operate inconjunction to provide the presently disclosed component.

In a similar manner, a presently disclosed component(s) can be embodiedin operational data or operational data can be used by a presentlydisclosed component(s). By way of example, such operational data can bestored on a tangible computer readable medium. The operational data canbe a single data set, or it can be an aggregation of data stored atdifferent locations, on different network nodes or on different storagedevices.

The method or apparatus according to the subject matter of the presentapplication can have features of different aspects described above orbelow, or their equivalents, in any combination thereof, which can alsobe combined with any feature or features of the method or apparatusdescribed in the Detailed Description presented below, or theirequivalents.

According to an aspect of the presently disclosed subject matter, thereis provided a method and apparatus for generating a readable matrixcode.

In accordance with an aspect of the presently disclosed subject matter,there is provided a method of generating a readable matrix code imageencoding a message based on an input image and a readable matrix codingspecification. According to examples of the presently disclosed subjectmatter, the method of generating a readable matrix code image caninclude: calculating function areas readable to comply with a functionpatterns specification; determining an extent of free cells and derivedcells according to a code word specification; calculating decode inputvalues for free cells such that the appearance of the free cellscompared to respective areas of the input image complies with a visualperceptual similarity criterion and with the code word specification;and calculating decode input values for derived cells based on the freecells decode input values and in compliance with the code wordspecification.

In accordance with an example of the presently disclosed subject matter,the method can further include fusing the input image and each of thecalculated functions areas, the free cells, and the derived cells toform a readable matrix code.

In accordance with yet a further example of the presently disclosedsubject matter, the method can further include scanning and decoding thereadable matrix code to obtain the message.

In accordance with still a further example of the presently disclosedsubject matter, the method can also include selecting cells from thefree cells as selected cells, wherein the selected cells are cells whichare selected from the free cells readable to provide a specified messageor a specified part of a message.

In accordance with examples of the presently disclosed subject matter,selecting cells from the free cells can also include assigning decodeinput values to the selected cells such that the encoded messageincludes a URL of a network resource.

In accordance with a further example of the presently disclosed subjectmatter assigning decode input values to the selected cells can includeassigning decode input values to the selected cells such that the URLincludes a network resource and a key that is associated with the inputimage or with the readable matrix code.

In accordance with examples of the presently disclosed subject matter,the method can further include implementing a saliency criterion andusing the saliency criterion to designate the free cells.

Further in accordance with examples of the presently disclosed subjectmatter, the method can include using the saliency criterion to determinea portion of the input image to which the matrix code is to be applied;and applying each of the calculating function areas, calculating freecells decode input values and calculating derived cells decode inputvalues based on the portion of the input image to which the matrix codeis to be applied.

According to examples of the presently disclosed subject matter, fusingcan include processing at least one of the free cells' decode inputvalues and the derived cells' decode input values considering imagingconditions, to thereby adjust at least one decode input valueaccordingly.

According to examples of the presently disclosed subject matter, fusingcomprises calculating pixels values for a group of pixels correspondingto a cell from the calculated free cells or from the calculated derivedcells, such that a sub-group of the pixels is assigned with values whichare visually similar according to a local visual similarity criterion topixels from neighboring cells, and the remaining pixels receive valueswhich combine with pixels from the sub-group to provide a valid readablematrix code cell which has the decode input value that is associatedwith the cell.

In further examples of the presently disclosed subject matter, fusingcomprises implementing a tolerance criterion, and wherein the tolerancecriterion is used to provide a range of possible values for pixels inthe sub-group and/or for the remaining pixels.

In still further examples of the presently disclosed subject matter,fusing comprises calculating pixels values for a group of pixelscorresponding to a cell from the free cells or from the derived cells,such that a sub-group of the pixels is assigned with values which arevisually similar according to a local visual similarity criterion topixels from the input image which are associated with the cell, and theremaining pixels which are associated with the cell receive values whichwhen read and processed by a reader device with the pixels in thesub-group, the cell is considered valid and is decoded to provide thedecode input value associated with the cell.

In examples of the presently disclosed subject matter, the free cellsare data cells and the derived cells are error correction cells, andwherein the error correction decode input values encoded in the errorcorrection cells are derived from the data in the data cells.

In examples of the presently disclosed subject matter, the free cellscomprise portions of readable matrix code modules including errorcorrection cells and the derived cells include complementing portions ofthe modules and of the error correction cells.

In accordance with examples of the presently disclosed subject matter,the free cells are error correction cells and the derived cells are datacells, and wherein the data decode input values encoded in the datacells are derived from the error correction decode input values in theerror correction cells.

In accordance with examples of the presently disclosed subject matter,the free cells include one or more of the following: padding cells,border cells and metadata cells.

In accordance with an aspect of the presently disclosed subject matter,there is yet further provided an apparatus for generating a readablematrix code image encoding a message based on an input image and areadable matrix coding specification. According to examples of thepresently disclosed subject matter, the apparatus for generating areadable matrix code image can include a memory unit and a processingunit. In examples of the presently disclosed subject matter, the memoryunit can be capable of storing the input image and the readable matrixcoding specification. The processing unit can be capable of applying afunction patterns specification to function areas of the readable matrixcode image, applying a code word specification to code word areas of thereadable matrix code image, the code word areas including free areas andderived areas in an extent which is in compliance with the code wordspecification; wherein the free areas include free cells and derivedcells, and the processing unit is configured to apply a visualperceptual similarity criterion when processing the free cells, suchthat the appearance of the free cells, when compared to respective areasof the input image, comply with a visual perceptual similaritycriterion, and wherein the processing unit is configured to process thederived cells, such that the derived cells form, together with the freecells, providing a valid code word.

In examples of the presently disclosed subject matter, the processingunit is further configured to fuse the input image and each of thecalculated functions areas, the free cells, and the derived cells toform a readable matrix code.

In further examples of the presently disclosed subject matter, theprocessing unit can be further configured to select cells from the freecells as selected cells, wherein the selected cells are cells which areselected from the free cells readable to provide a specified message ora specified part of a message.

In accordance with an example of the presently disclosed subject matter,the processing unit can be configured to assign decode input values tothe selected cells such that the encoded message includes a URL of anetwork resource.

In further examples of the presently disclosed subject matter, theprocessing unit can be further configured to assign decode input valuesto the selected cells such that the URL includes a network resource anda key that is associated with the input image or with the readablematrix code.

Still further by way of example, the processing unit can be configuredto implement a saliency criterion and to use the saliency criterion todesignate the free cells.

Yet further by way of example, the processing unit can be configured toimplement a saliency criterion to determine a portion of the input imageto which the matrix code is to be applied, and wherein the processingunit can be configured to calculate decode input values for each of thefunction areas, free cells and derived cells based on the portion of theinput image to which the matrix code is to be applied.

According to examples of the presently disclosed subject matter, as partof the fusing of the input image and each of the calculated functionsareas, the free cells, and the derived cells, the processing unit can beconfigured to process decode input values of at least one of the freecells or derived cells using a robustness criterion that is associatedwith imaging conditions, to thereby adjust at least one decode inputvalue accordingly.

Further by way of example, as part of the fusing of the input image andeach of the calculated functions areas, the free cells, and the derivedcells, the processing unit can be configured to calculate pixels valuesfor a group of pixels corresponding to a cell from the calculated freecells or from the calculated derived cells, such that a sub-group of thepixels can be assigned with values which are visually similar accordingto a local visual similarity criterion to pixels from neighboring cells,and the remaining pixels receive values which combine with pixels fromthe sub-group to provide a valid readable matrix code cell which has thedecode input value that is associated with the cell.

Still further by way of example, as part of the fusing of the inputimage and each of the calculated functions areas, the free cells, andthe derived cells, the processing unit can be configured to implement atolerance criterion, and wherein the tolerance criterion can be used bythe processing unit to provide a range of possible values for pixels inthe sub-group and/or for the remaining pixels.

Yet further by way of example, as part of the fusing of the input imageand each of the calculated functions areas, the free cells, and thederived cells, the processing unit can be configured to calculate pixelsvalues for a group of pixels corresponding to a cell from the free cellsor from the derived cells, such that a sub-group of the pixels isassigned with values which are visually similar according to a localvisual similarity criterion to pixels from the input image which areassociated with the cell, and the remaining pixels which are associatedwith the cell receive values which when read and processed by a readerdevice with the pixels in the sub-group, the cell is considered validand can be decoded to provide the decode input value associated with thecell.

According to examples of the presently disclosed subject matter, thefree cells can be data cells and the derived cells can be errorcorrection cells, and the processing unit can be configured to deriveerror correction decode input values encoded in the error correctioncells from the data in the data cells.

In further examples of the presently disclosed subject matter, the freecells comprise portions of readable matrix code symbols and errorcorrection cells, and wherein the processing unit can be configured toinclude in the derived cells complementing portions of the symbols andof the error correction cells.

In still further examples, the free cells can be error correction cellsand the derived cells can be data cells, and wherein the processing unitcan be configured to derive the data decode input values encoded in thedata cells from the error correction decode input values in the errorcorrection cells.

According to examples of the presently disclosed subject matter, theprocessing unit can be configured to include in the free cells one ormore of the following: padding cells, border cells and metadata cells.

In some examples of the presently disclosed subject matter, the memoryunit can be further capable of storing charge information for enablingcharging for the readable matrix code image.

In accordance with an aspect of the presently disclosed subject matter,there is yet further provided a readable matrix code image fusing aninput image and a message based on a readable matrix codingspecification. According to examples of the presently disclosed subjectmatter, the readable matrix code image can include function areas and acode word area, and the code word area can include a free cells area anda derived cells area. The function patterns areas can be readable tocomply with a function patterns specification. The code word area can bereadable to comply with a code word specification, and the code wordarea can include the free cells area and the derived cells area, whereinthe free cells area and the derived cells area are provided in an extentwhich is in compliance with the code word specification. The free cellsarea can represent free cells' whose appearance, when compared torespective areas of the input image, complies with a visual perceptualsimilarity criterion. The derived cells area can form, together with thefree cells area, a valid code word.

According to examples of the presently disclosed subject matter, thereadable matrix code image can further include a selected cells area.For example, the selected cells area can be readable matrix code cellswhich are selected from the free cells, and the selected cells areas arereadable to provide a specified message or a specified part of amessage.

By way of example, the specified message or the specified part of amessage that can be encoded in the selected cells area includes a URL ofa network resource.

Further by way of example, the specified message or the specified partof a message that can be encoded in the selected cells area includes aURL of a network resource and a key that can be associated with theinput image or with the readable matrix code.

According to yet further examples of the presently disclosed subjectmatter, for a group of pixels corresponding to a free cell or to aderived cell, pixel values can be provided, such that a sub-group of thepixels has values which are visually similar according to a local visualsimilarity criterion to pixels from neighboring cells, and the remainingpixels of the cell providing values which combine with pixels from thesub-group to provide a valid readable matrix code cell which has adecode input value that is associated with the cell.

In still further examples of the presently disclosed subject matter, fora group of pixels corresponding to a cell from the free cells or fromthe derived cells, pixels values can be calculated, such that asub-group of the pixels has values which are visually similar accordingto a local visual similarity criterion to pixels from the input imagewhich are associated with the cell, and the remaining pixels which areassociated with the cell have values which when read and processed by areader device with the pixels in the sub-group, yield a valid readablematrix code cell.

In examples of the presently disclosed subject matter, the free cellsarea can correspond to data cells and the derived cells area cancorrespond to error correction cells, and wherein error correctiondecode input values encoded in the derived cells area can be derivedfrom the data decoded in the free cells area.

In further examples, the free cells areas can encode portions ofreadable matrix code modules including error correction cells and thederived cells areas can encode complementing portions of the modules andof the error correction cells.

In yet further examples, the free cells area can encode error correctiondata and the derived cells area can encode data, and wherein data decodeinput values encoded in the derived cells area can be derived from thedecode input values encoded in the free cells area.

In examples of the presently disclosed subject matter, one or moreportions of the free cells area can be associated with one or more ofthe following: padding cells, border cells and metadata cells.

In accordance with an aspect of the presently disclosed subject matter,there is yet further provided a program storage device readable bymachine, tangibly embodying a program of instructions executable by themachine to generate a readable matrix code image encoding a messagebased on an input image and a readable matrix coding specification.According to examples of the presently disclosed subject matter, theprogram storage device can tangibly encode instructions for: providingfunction areas readable to comply with a function patternsspecification; providing code word areas readable to comply with a codeword specification, the code word areas including free areas and derivedareas in an extent which is in compliance with the code wordspecification; wherein the free areas include free cells whoseappearance, when compared to respective areas of the input image, complywith a perceptual similarity criterion, and wherein the derived cellsform, together with the free cells, a valid code word.

In accordance with an aspect of the presently disclosed subject matter,there is yet further provided a computer program product comprising acomputer useable medium having computer readable program code embodiedtherein for causing the computer to generate a readable matrix codeimage encoding a message based on an input image and a readable matrixcoding specification. In examples of the presently disclosed subjectmatter, the computer useable medium can include: computer readableprogram code for causing the computer to provide function areas readableto comply with a function patterns specification; computer readableprogram code for causing the computer to provide code word areasreadable to comply with a code word specification, the code word areasincluding free areas and derived areas in an extent which is incompliance with the code word specification, wherein the free areasinclude free cells whose appearance, when compared to respective areasof the input image, comply with a perceptual similarity criterion, andwherein the derived cells form, together with the free cells, a validcode word.

BRIEF DESCRIPTION OF THE DRAWINGS

In order to understand the invention and to see how it may be carriedout in practice, a preferred embodiment will now be described, by way ofnon-limiting example only, with reference to the accompanying drawings,in which:

FIG. 1 is a block diagram illustration of a device for generating areadable matrix code representation, according to examples of thepresently disclosed subject matter;

FIG. 2 is a block diagram illustration of computer which may be used togenerate a readable matrix code representation, according to examples ofthe presently disclosed subject matter;

FIG. 3 is a flowchart illustration of a method of generating a readablematrix code representation, according to examples of the presentlydisclosed subject matter;

FIG. 4 is a graphical illustration of a fusing operation according toexamples of the presently disclosed subject matter;

FIG. 5 is a graphical illustration of a fusing operation according toexamples of the presently disclosed subject matter;

FIG. 6 is a flowchart illustration of a method of generating a readablematrix code representation, according to examples of the presentlydisclosed subject matter;

FIG. 7 is a block diagram illustration of a device for generating areadable matrix code representation image, according to examples of thepresently disclosed subject matter;

FIG. 8 is a flowchart illustration of a method of generating a readablematrix code representation, according to examples of the presentlydisclosed subject matter;

FIG. 9 is a graphical illustration of a process of generating a readablematrix code representation based on the Facebook® logo, according toexamples of the presently disclosed subject matter; and

FIG. 10 is a graphical illustration of a process of generating areadable matrix code representation based on the Facebook® logo,according to examples of the presently disclosed subject matter.

It will be appreciated that for simplicity and clarity of illustration,elements shown in the figures have not necessarily been drawn to scale.For example, the dimensions of some of the elements may be exaggeratedrelative to other elements for clarity. Further, where consideredappropriate, reference numerals may be repeated among the figures toindicate corresponding or analogous elements.

DETAILED DESCRIPTION

In the following detailed description, numerous specific details are setforth in order to provide a thorough understanding of the presentlydisclosed subject matter. However, it will be understood by thoseskilled in the art that the presently disclosed subject matter may bepracticed without some of these specific details. In other instances,well-known methods, procedures and components have not been described indetail so as not to obscure the presently disclosed subject matter.

Unless specifically stated otherwise, as apparent from the followingdiscussions, it is appreciated that throughout the specificationdiscussions various functional terms refer to the action and/orprocesses of a computer or computing device, or similar electroniccomputing device, that manipulate and/or transform data represented asphysical, such as electronic, quantities within the computing device'sregisters and/or memories into other data similarly represented asphysical quantities within the computing device's memories, registers orother such tangible information storage, transmission or displaydevices.

According to an aspect of the presently disclosed subject matter thereis provided a method of generating a readable matrix coderepresentation. According to a further aspect of the presently disclosedsubject matter there is provided an encoded image fusing an input imageand a message according to a readable matrix coding specification. Yetaccording to a further aspect of the presently disclosed subject matterthere is provided an apparatus for generating a readable matrix coderepresentation. According to yet another aspect of the presentlydisclosed subject matter there is provided a program storage devicereadable by machine, tangibly embodying a program of instructionsexecutable by the machine to perform a method of generating a readablematrix code representation image encoding a message based on an inputimage and a readable matrix coding specification. In still a furtheraspect of the presently disclosed subject matter there is provided acomputer program product comprising a computer useable medium havingcomputer readable program code embodied therein computer readableprogram code for causing the computer to generate a readable matrix codeimage encoding a message based on an input image and a readable matrixcoding specification.

According to examples of the presently disclosed subject matter, themethod of generating a readable matrix code representation can include:obtaining a message, an input image and a readable matrix codingspecification. Calculating function areas readable to comply with afunction patterns specification; determining an extent of free cells andderived cells according to a code word specification; calculating valuesfor free cells such that the appearance of the free cells compared torespective areas of the input image complies with a visual perceptualsimilarity criterion and with the code word specification; andcalculating values for derived cells based on the free cells values andin compliance with the code word specification.

Throughout the description and the claims, reference is made to the term“readable matrix code”. The term readable matrix code is known in theart of optical machine-readable coding, and the following definition isprovided as a non-limiting example only for convenience purposes.Accordingly, the interpretation of the term readable matrix code in theclaims, unless stated otherwise, is not limited to the definitions belowand the term should be given its broadest reasonable interpretation. Theterm readable matrix code as used herein relates to an opticalmachine-readable representation of data in the form of a two-dimensionalpattern of symbols. Examples of known matrix code types include:QR-Code, EZcode and DataMatrix.

Different matrix code types are associated with different respectivereadable matrix code specifications. The term readable matrix codespecification is known in the art of optical machine-readable coding,and the following definition is provided as a non-limiting example onlyfor convenience purposes. Accordingly, the interpretation of the termreadable matrix code specification in the claims, unless statedotherwise, is not limited to the definitions below and the term shouldbe given its broadest reasonable interpretation. The term readablematrix code specification as used herein relates to a framework ofspecifications which collectively define various aspects relating to thevisual appearance of an object that has some code that is visuallyencoded in the object in the form of a visual matrix code. By way ofexample, a readable matrix code specification can include some or all ofthe following: a general matrix specification, a basic cellspecification, a function (such as finder) patterns specification, acode word area specification, a free cells specification, a derivedcells specification and a selected cells specification.

Based on a given readable matrix code specification, a compatibledecoder can be designed and operated to allow identification, scanningand decoding of visual objects that include compatible matrix code.

It should be noted that some matrix coding specifications includetolerances or variations and allow for the appearance of the cellsand/or of the two-dimensional patterns to have different appearances orto shift within a certain range without rendering the matrix codeunreadable. For example, some types of readable matrix codespecifications can include: different coding modes, different masks,reflectance reversal, mirror imaging etc., and a message can beassociated with different matrix codes representations, for exampleaccording to the different modes, masks, etc., and each of the differentrepresentations can be compatible with the readable matrix codespecification. It would be appreciated that throughout the presentdisclosure and in the claims, the term tolerance encompasses also anegative tolerance which can be effective for limiting a certain rangeof values which is suggested or required for cells or patterns that arepart of a readable matrix code.

Furthermore, it should be noted, that some scanners, imagers, readersand/or decoders allow certain tolerances and/or deviations from thereadable matrix code specification as will be further explained below.

Accordingly, in some examples of the presently disclosed subject matter,the term readable matrix code can refer to a matrix code that iscompatible with a respective readable matrix code specification, and infurther examples of the presently disclosed subject matter, the termreadable matrix code can be a representation of a matrix code that isreadable according to a certain matrix code specification that isconfigured, adapted or adjusted in accordance with the specificcharacteristics of a given scanner, reader or decoder any combinationsthereof, or even to a general characteristic of scanners, readers ordecoders. In the latter case, the readability or eligibility of thematrix code is determined according to the ability, possibly thede-facto ability, of a certain decoding device or devices to decode agiven matrix code representation that is generated based on a givenreadable matrix code specification and the tolerances and/or deviationsthat are supported or corrected by the decoding device or devices.

For example, the QR-Code specification (used here as an example of areadable matrix code specification) defines the color values of cells asdark and light. By way of example, a QR-Code scanner, that is a matrixcode scanner that is configured to scan and decode matrix codes that arecompatible with the QR-Code specification, can convert an image whichincludes dark and light colors which represent a matrix code to a set ofdark and light pixels using a global threshold, and thus the coloredimage provides a readable matrix code. By way of example, the globalthreshold that is implemented by the QR-Scanner can be determined bytaking a reflectance value midway between the maximum reflectance andminimum reflectance in the image. This means that an image whichrepresents a readable matrix code, according to examples of thepresently disclosed subject matter, can have a wide range of colorchoices for areas which represent readable matrix code cells for whichthe readable matrix code specification suggests a light or a dark value.

In this sense, according to examples of the presently disclosed subjectmatter, a matrix code can be considered to be a readable matrix code,even when the colors that are used in the matrix code or in the imagewhich represents the matrix code are not explicitly, in and ofthemselves, compatible with the corresponding readable matrix codespecification, but are such that when read and processed by thereader/decoder the resulting color values are compatible with thereadable matrix code specification. In such cases, the colors that areused in the matrix code or in the image which represents the matrix codecan be based on the readable matrix code specification, but additionalprocessing can be applied to take advantage, inter-alia, of thetolerances, characteristics, configurations and/or capabilities of thedecoders, scanners or imagers, (or any other equipment that is used toprocess an image and decode a matrix code thereform), such that thevalues that are calculated for the matrix code provide a certain level(e.g., the highest possible) of visual perceptual similarity torespective areas of an input image, while meeting, de-facto, followingimaging, scanning, processing, etc. the requirements of the readablematrix code specification.

In another example, the QR-Code specification suggests that a readerapparatus reads and defines the colors of certain cells or areas of aQR-Code representation by sampling a small group of pixels around thecenter of each cell and comparing the sampled values to the globalthreshold. This means that in certain cells it is not necessary that allpixels will meet the conditions that are suggested or required by thereadable matrix code specification with respect to the global threshold,and the colors of the matrix code representation can be varied, suchthat through the imaging or processing of the captured image, theresulting colors of the cells are compatible with the QR-Codespecification, and thus the matrix code representation is consideredaccording to examples of the presently disclosed subject matter to be areadable matrix code or in this particular example, a readable QR-Code.

In yet another example, the QR-Code specification includes a tolerancewith respect to the width of certain function patterns (which aresometimes also referred to as the “modules”), such as the finderpattern, and certain cells (which are sometimes also referred to as“modules”). The terms “function pattern”, modules” and “function cells”are used herein interchangeably. Therefore, for example, when a readerapparatus reads and localizes the finder patterns it can be configuredto search for a range of frequency patterns. Thus, readable matrix codespecifications which support this feature can allow some freedom withregard to the width and height of the function pattern, within thetolerance, and a matrix code which includes functions areas, whichrepresent function patterns, whose width and height are within theallowed range can be regarded as a readable matrix code and compatiblewith the corresponding readable matrix code specification.

In still another example, the QR-Code specification supports an errorcorrection feature. The QR-Code images include error symbols, and eacherror correction symbol includes one or more error correction cells,which together form the error correction symbol. The error correctionsymbols (and the error correction cells which constitute the symbols)enable a certain amount of errors when reading and determining the cellvalues. According to examples of the presently disclosed subject matter,a QR-Code can be generated which, intentionally, or as a result of theprocess of generating a readable matrix code representation, accordingto examples of the presently disclosed subject matter, includes certainerrors which can be corrected using the redundant data (e.g., the errorcorrection data) that is included in the QR-Code. Thus, according toexamples of the presently disclosed subject matter, when a readerapparatus reads and decodes the image which represents readable matrixcode, the errors can be corrected using the included redundant data, andthe matrix code with the included errors is thus considered a valid andreadable matrix code.

Throughout the description and the claims, reference is made to theterms “decoding device” (or “decoder” in short), “matrix code reader”(or “reader” in short), “matrix code scanner” (or “scanner” in short) orthe like. Unless specifically stated otherwise, or if it is apparentfrom the description the terms “decoding device” (or “decoder” inshort), “matrix code reader” (or “reader” in short), “matrix codescanner” (or “scanner” in short) and the like are used interchangeably.The terms decoding device, matrix code reader and matrix code scannerare known in the art of optical machine-readable decoding, and thefollowing definition is provided as a non-limiting example only forconvenience purposes. Accordingly, the interpretation of the termsdecoding device, matrix code reader and matrix code scanner in theclaims, unless stated otherwise, is not limited to the definitions belowand the term should be given its broadest reasonable interpretation. Theterms decoding device, matrix code reader and matrix code scanner asused herein relate to an electronic device which is used in the processof detecting, imaging, scanning and/or decoding of a an image whichrepresents a matrix code. It would be appreciated that such devices canbe configured to operate according to one or more readable matrix codesspecifications. As described above, according to examples of thepresently disclosed subject matter, a given decoding device, matrix codereader and matrix code scanner can include various features and/orcapabilities and/or configurations that can have an effect on the codematrix values that are assigned to areas of an image which correspond todifferent matrix code cells. By this effect, areas of the image which donot “appear” to be compatible to a corresponding readable matrix codespecification, can be “turned” into valid values according to thereadable matrix code specification. Thus, according to examples of thepresently disclosed subject matter, a readable matrix code can begenerated based on the readable matrix code specification and also basedon the characteristics and/or configurations of the reading andprocessing hardware and software which can be used to scan, read and/ordecode various images that represent matrix codes that include variousvariations relative to the readable matrix code specification, and suchdevices (hardware or software) either by design or as a side effect oftheir characteristics and/or configurations can render the image into areadable matrix code that is compatible with a readable matrix codespecification.

In this regard, as mentioned above, it would be appreciated that thematrix code or the method or device for generating a matrix codeaccording to examples of the presently disclosed subject matter, can betuned or configured according to the characteristics of a given scanner,reader or decoder and any combination thereof, or a group of suchscanners, reader or decoder, or according to the characteristics and/orconfiguration of a group of such devices (or software modules) or it caneven be configured according to a general characteristic orconfiguration of scanners, readers or decoders. It would be appreciated,that according to examples of the presently disclosed subject matter, arepresentation in an image of a matrix code should be considered as areadable matrix code according to a corresponding readable matrix codespecification, when taking into account the characteristics and/or theconfiguration of the scanner, reader or decoder, and the variousfeatures and tolerances in the readable matrix code specification whichallow some extent of flexibility with respect to the values of thedifferent matrix code cells.

Throughout the description and the claims, reference is made to the term“input image”. The term input image is known in the art of opticalmachine-readable coding, and the following definition is provided as anon-limiting example only for convenience purposes. Accordingly, theinterpretation of the term input image in the claims, unless statedotherwise, is not limited to the definitions below and the term inputimage should be given its broadest reasonable interpretation. The terminput image as used herein relates to a digital representation of atwo-dimensional figure, such as a painting, photograph, map, chart,drawing or print. According to examples of the presently disclosedsubject matter, the input image complies with the basic requirementsthat are set forth by the readable matrix coding specification. Forexample, the dimensions of the input image may be required to be incompliance with the requirement set forth in the readable matrix codingspecification.

It would be appreciated that the matrix coding specification can supporta variety of different sizes and dimensions and the input image can havedimensions which match any one of the supported dimensions. Further, thedimensions of the input image can be different from any of the preferreddimensions which are set forth in the readable matrix codespecification. For example, in such cases where the input image'sdimensions are different from any of the preferred dimensions which areset forth in the readable matrix code specification, the input image canbe re-sampled to fit the preferred dimensions. Furthermore, even withoutsuch re-sampling, in some examples of the presently disclosed subjectmatter, the tolerance presented by the readable matrix codespecification and the reading process performed by a matrix code readerapparatus can be taken advantage of. For example, the cells' dimensionstolerance can be exploited by altering the specification's suggesteddimensions of few cells, such that the final matrix code dimensions willfit to the input image one.

It would also be appreciated that the input image that is used inexamples of the presently disclosed subject matter is some version of anoriginal image which was modified in order to prepare a matrix coderepresentation for processing according to examples of the presentlydisclosed subject matter. For example, the original image can havecertain dimensions which are not supported or suggested by the readablematrix coding specification, and the original image can be cropped orresized manually or automatically using some predefined cropping orresizing algorithm so that the dimensions of the modified input imageare supported or suggested by the readable matrix coding specification.

It would also be appreciated that some readable matrix codespecifications can require or suggest that cells of the readable matrixcode be of an integer width and/or height, while the tolerance presentedby the matrix code specification and the reading process performed bysome matrix code readers can enable the creation of a readable matrixcode with non-integer cells' measures, for instance by sharing a certainborder pixel between two cells, or re-sampling the matrix code. Inaddition, according to examples of the presently disclosed subjectmatter, an original image can undergo preprocessing before being fed tothe process or device according to examples of the presently disclosedsubject matter, whereby, for example, the original image can bere-sampled and its dimensions can be adjusted according to at least oneof the dimensions that are supported or suggested by a readable matrixcode specification.

According to examples of the presently disclosed subject matter theinput image can be part of the original image, and the readable codingmatrix resulting from the process according to examples of the presentlydisclosed subject matter can be combined with the part of the originalimage that completes the input image. Thus for example, the result canbe a readable matrix code representation surrounded by and “merged” withthe unprocessed part of the original image.

It should also be appreciated, that the input image, in its originalform can be in any form or format which can be converted to a digitalvisual representation, e.g., a digital image or a file which representsa digital image. Examples of types of visual representation which can bethe source of the input image can include: prints, digital images,impressions, holograms, text, text representation of images, etc.

Throughout the description and the claims, reference is made to the term“output image”. The term output image is known in the art of opticalmachine-readable coding, and the following definition is provided as anon-limiting example only for convenience purposes. Accordingly, theinterpretation of the term output image in the claims, unless statedotherwise, is not limited to the definitions below and the term outputimage should be given its broadest reasonable interpretation. Someaspects of the term input image are defined by some of the features ofthe process that is disclosed herein and will be apparent from thedisclosure. In addition, it should be noted that the output image can bea digital representation of a readable matrix code as is describedbelow. It should also be appreciated that the input image and the outputimage can be presented in various forms including, but not limited to:pixels on at least one digital visual display, print parameters forconfiguring a digital printer to print an image which corresponds to thedigital representation of the readable matrix code which constitutes theoutput image, vectors on at least one digital visual display, colorfrequencies on at least one digital visual display, etc. According toexamples of the presently disclosed subject matter, the output image, inwhatever form, represents a readable code matrix, and different areas inthe output image represent individual cells or patterns or the readablecode matrix. Accordingly, the output image enables an imager, scannerand/or decoder to convert the image to cells of a matrix code in mannerto allow decoding of the output image according to a correspondingreadable matrix code specification.

Throughout the description and the claims, reference is made to the term“function patterns”, “function modules” or “function cells” which areused herein interchangeably. The terms, function pattern, functionmodule or function cells, are known in the art of opticalmachine-readable coding, and the following definition is provided as anon-limiting example only for convenience purposes. Accordingly, theinterpretation of the term function pattern, function module orfunctions cell in the claims, unless stated otherwise, is not limited tothe definitions below and should be given its broadest reasonableinterpretation. Function pattern, function module or function cell asused herein relate to a group of matrix code cells that are defined in acorresponding readable matrix code specification and which serve apredefined ancillary function which can be used in the imaging, scanningand/or decoding process of the message that is encoded in the readablematrix code. For example, function patterns can be used for indicatingthe location of the readable matrix code or to specify certaincharacteristics of the readable matrix code. For example the QR-Codespecification includes provisions for the following function patterns:finder, separator, timing patterns, and alignment patterns.

Throughout the description and the claims, reference is made to the term“encoding region”. The term encoding region is known in the art ofoptical machine-readable coding, and the following definition isprovided as a non-limiting example only for convenience purposes.Accordingly, the interpretation of the term encoding region in theclaims, unless stated otherwise, is not limited to the definitions belowand should be given its broadest reasonable interpretation. The termencoding region as used herein relates to a region of the readablematrix code that is not occupied by function patterns and is availablefor encoding of data and error correction code words, and for metadatacells, which provide necessary or optional information about the format,version and other characteristics of the encoded data.

Throughout the description and the claims, reference is made to the term“code word” or “code words”. The terms code word or code words are knownin the art of optical machine-readable coding, and the followingdefinition is provided as a non-limiting example only for conveniencepurposes. Accordingly, the interpretation of the term code word in theclaims, unless stated otherwise, is not limited to the definitions belowand should be given its broadest reasonable interpretation. The termcode word as used herein relates to a bit stream that is used in areadable matrix code to structure a code message into words. A readablematrix code specification usually suggests (or requires) a certainstructure for the code word or enables a selection of one of a pluralityof predefined structures. For example, in the QR-Code specification aword is usually defined by an 8-bit array. A code word can structure adata bit stream, an error correction bit stream, both data and errorcorrection bit streams and can include metadata.

The final code word is usually comprised of a set of code words andpossibly some metadata that are to be encoded in the encoding region ofthe readable matrix code. By way of example the final code word caninclude data code words, error correction code words, and metadata.

Throughout the description and the claims, reference is made to the term“free cells”. The term free cells as used herein relates to code wordcells (cells which are included in the code word), and more specificallyto the code word cells that can receive any valid value according to thereadable matrix code specification. According to examples of thepresently disclosed subject matter, the values for at least some of thefree cells can be calculated according to an appearance of respectiveareas of an input image with which the readable matrix code isassociated.

It should be appreciated that for code word cells, including for freecells, a general cell specification (which is part of the readablematrix code specification) can define a valid value as either dark orlight, i.e., the values for the code word cells are binary. Furthermore,in some readable matrix code specifications, the value of a cell can bemodified in the decoding process, for example, by applying a mask to thereadable matrix code during the decoding process. Accordingly, thevalues that are calculated for the different cell types as part of theprocess of generating a readable matrix, according to examples of thepresently disclosed subject matter, are based on, inter-alia, the values(e.g., the dark/light binary values) which are set forth by the readablematrix code specification, when the readable matrix code is provided asinput to the decoder. It should be appreciated that in some readablematrix code specifications, more than two valid values are defined.

As mentioned above, the general cell specification of the readablematrix code specification can set forth a definition of a valid value.Such a value is termed herein a “decode input value”. By way of examplea valid value for a cell according to the general cell specification isa binary value, i.e., the cell is required to be either dark or light.As mentioned above, the decode input value can be modified in thedecoding process, for example, by a mask that is applied to the readablematrix code in the decoding process. In such cases, the value ofinterest for the process of generating a readable matrix code accordingto examples of the presently disclosed subject matter, is the value atthe input to the decoder, which is not necessarily the same as the valueafter decoding (e.g., due to use of masking in the decoding process). Itwould be also appreciated, that some decoders can implementpreprocessing of the readable matrix code and other operations which areintended to prepare the readable matrix code for the actual decoding.The decode input values which are referred to herein are the valueswhich are received after such preprocessing, if exists. It should beappreciated that in some readable matrix code specifications, more thantwo valid values are defined. Therefore, for example, the decode inputvalue may be of a ternary type (or of any other N values type).

According to examples of the presently disclosed subject matter, thevalues that are calculated for some of the cells of the readable matrixcode can be color values and/or luminosity values. As will be describedin further detail below, the process of generating a readable matrixcode according to examples of the presently disclosed subject matter,can be used to determine, for different cells of a readable matrix code(e.g. for the pixel or pixels which represent the cells), the colorand/or luminosity values that can be used to represent the decode inputvalues of the cells. As will also be described below, the process ofgenerating a readable matrix code according to examples of the presentlydisclosed subject matter can be configured to take into account certaincharacteristics, configurations and/or capabilities of the imager,scanner and/or decoder (or a device which combines these functions) thatare used in the process of capturing a representation of the readablematrix code, scanning the readable matrix code and/or preparing it fordecoding, to expand the possible range of values which can be used forrepresenting some of the cells of the readable matrix code beyond therange of valid decode input values, including using a range of colorand/or luminosity values for the pixels which represent the cells. Theprocess of generating a readable matrix code according to examples ofthe presently disclosed subject matter, can be used to allow a certainlevel of freedom with regard to the appearance of some areas of areadable matrix code representation, while meeting the requirements ofthe readable matrix code specification at the decode starting point, toallow for an appearance which has a certain visual similarity to theinput image. Further by way of illustration, according to examples ofthe presently disclosed subject matter, the decode input values whichare associated with the free cells are essentially a result of theprocess of generating a readable matrix code that is described herein,and the values for the free cells are essentially not limited by acertain target set of decode input values.

Furthermore, according to examples of the presently disclosed subjectmatter, assuming that the decode input values which arerequired/suggested by the readable matrix code specification define afirst set of values, the color values and/or luminosity values that arecalculated for the areas which represent cells in a readable matrix codeaccording to examples of the presently disclosed subject matter, definea second set of values which is larger than the first set, such thateach value in the first set is associated with two or more (e.g., 2, 3,. . . , n) values in the second set. It would be further appreciatedthat according to examples of the presently disclosed subject matter,the second set can include two or more (e.g., 2, 3, . . . , n) subsetsand the values in the first set can be associated with one or morevalues in each subset of the second set. Thus, for example, a light/darkvalue from the first set can be associated with a plurality of colorvalues and with a plurality of luminosity values.

Returning now to the definition of the term “free cells” as it is usedherein. According to examples of the presently disclosed subject matter,the values for the free cells are valid in the sense that they meet thegeneral cell specification in the readable matrix code specification atthe decode start point. For example, the values for the free cells canbe calculated based on the requirements and/or suggestions set forth inthe general cell specification regarding the valid range of cell values,and for at least some of free cells, the values can be calculatedfurther based on the appearance of respective areas of the input imagewith which the readable matrix code is associated. Thus, the values forthe free cells, can for example include color and/or luminosity values,which, at the decode start point, are translated to dark/light valueswhich are valid according to the readable matrix code.

In this regard, it would be appreciated that based on the readablematrix code specification or based on user or otherwise definedconfigurations, the values of some of the cells can be restricted ordependent (beyond the restrictions set forth in the general cellspecification), and according to examples of the presently disclosedsubject matter, such cells are not considered “free cells”. For example,free cells include only the code word cells which are not restricted ordependent based on the readable matrix code specification or based onuser or otherwise defined configurations (not including the restrictionsset forth in the general cell specification), and possibly also includepadding cells, and possibly also include some border cells, for whichthe user or/and a selection based on a predefined criterion or rule areallowed to select the color and/or luminosity values as long as theselected values meet the general cell specification at the decode startpoint.

In the following description, for convenience and by way of example,free cells are sometimes referred to as being code word cells of areadable matrix code. In some examples of the presently disclosedsubject matter, the free cells can also include padding cells and/orborder cells which are suggested and/or required by the correspondingreadable matrix code specification. In other examples of the presentlydisclosed subject matter, padding/border cells are not considered freecells and different processing is applied to the free cells and to thepadding cells.

According to examples of the presently disclosed subject matter, thegeneral cells specification that is included in the readable matrix codespecification can provide the suggestions or requirements with respectto the free cells. The general cells specification includes the basicrules which apply to substantially all the cells in the matrix code andprovide the framework of the readable matrix code. For example, thegeneral cells specification can include a requirement that the colorvalues of the cell will be selected from a first set of colors, whichis, for example, a relatively small set. Further by way of example, theset of colors that is allowed or suggested according to the generalcells specification can be smaller than the set of colors that is usedin the process of generating a readable matrix code, in particular forfree cells. In some readable matrix code specification the suggested orrequired set of colors for readable matrix code cells is binary and adecode input value needs to be either dark or light. By way of example,the general cells specification can suggest or require a certain limitwith respect to the range of values that a free cell can receive.Accordingly, the free cells can be regarded as free in the sense thatthey can receive any value that is within the general framework.

As mentioned above, a readable matrix code speciation can includecertain tolerances, which can be implemented as part of the process ofgenerating a readable matrix code according to examples of the presentlydisclosed subject matter. Further by way of example, the tolerancesincluded in the readable matrix code specification can be effective forincreasing or decreasing the range of values that free cells can receivein the process of generating a readable matrix code.

Furthermore, the limit on the range of data that can be encoded in thefree cells can be associated with characteristics of a given scanner,reader or decoder any combinations thereof, or even to a generalcharacteristic of scanners, readers or decoders. For example, in theprocess of generating a readable matrix code representation, the rangeof values that are allowed for the free cells can be determinedaccording to the readable matrix code specification and further inaccordance with a characteristic(s) of the scanner/reader/decoder. Morespecifically, in some examples of the presently disclosed subjectmatter, the range of allowed values for the free cells that is used inthe process of generating a readable matrix code can be adjusted(relative to what is suggested or required in the readable matrix codespecification) according to a characteristic(s) of thescanner/reader/decoder.

As would be appreciated, a readable matrix code specification allocatesa certain part of the readable matrix code, and more specifically of thecode word, for free cells, which for example, allow a user (or someother input message source) to enter specific data that is to be encodedin the readable matrix code. In still further examples, the readablematrix code specification allocates a certain part of the code word forderived cells. Further by way of example, in order to be valid (orreadable), the code word of the matrix code needs to include a certainextent of derived cells (e.g., error correction cells), as will befurther described herein. In further examples, in addition to free cellsand derived cells, the code word of a readable matrix code can alsoinclude selected cells, as further discussed herein.

Throughout the description and the claims, reference is made to the term“derived cells”. The term derived cells is known in the art of opticalmachine-readable coding, and the following definition is provided as anon-limiting example only for convenience purposes. Accordingly, theinterpretation of the term derived cells in the claims, unless statedotherwise, is not limited to the definitions below and should be givenits broadest reasonable interpretation. The term derived cells, as usedherein, relates to cells which are part of a code word and whose valuesare derived from the value of corresponding free cells and according tothe readable matrix code specification.

According to examples of the presently disclosed subject matter, derivedcells can include error correction data which is derived fromcorresponding data that is encoded in corresponding free cells. However,in further examples of the presently disclosed subject matter, thederived cells can be the data cells, and the free cells can hold theerror correction data. In yet further examples of the presentlydisclosed subject matter, some of the free cells hold data and otherfree cells hold error correction data and the derived cells hold errorcorrection data which is associated with (and derived from) the data inthe free cells and data that is associated with (and derived from) theerror correction data in the free cells.

According to examples of the presently disclosed subject matter, for thederived cells, the decode input values can be first calculated accordingto the decode input values that are calculated for the free cells, andthen, the values for the derived cells (e.g., color and/or luminosityvalues) can be calculated based the derived cells' decode input valuesand based on a visual perceptual similarity to the respective areas ofthe input image.

For example, in QR-Code, the error correction method is based onReed-Solomon coding. This method produces a systematic binary code whichis a subset of a Binary Finite Field, hence it obeys the Binary FiniteField Arithmetic. Accordingly, a simple corresponding arithmetictechnique, (such as Gauss-Jordan Elimination) can be used to control(and free) the error correction cells (or some of them) whilerelinquishing the control of the data cells, which then become derivedcells according to examples of the presently disclosed subject matter.

Whether the derived cells hold the data or the complimenting errorcorrection data, according to examples of the presently disclosedsubject matter, the values for the derived cells are calculated based onthe values of the free cells. As mentioned above, according to examplesof the presently disclosed subject matter, the values that arecalculated for the derived cells (or for the pixels which represent thederived cells) can be color and/or luminosity values. Further by way ofexample, the values for the derived cells can be calculated such that inaddition to being associated with the values of corresponding freecells, the values are associated with the values set forth in thegeneral cell specification, such that at the decode start point, thevalues for the derived cells are valid according to the readable matrixcode specification.

Throughout the description and the claims, reference is made to the term“metadata cells”. The term metadata cells is known in the art of opticalmachine-readable coding, and the following definition is provided as anon-limiting example only for convenience purposes. Accordingly, theinterpretation of the term metadata cells in the claims, unless statedotherwise, is not limited to the definitions below and should be givenits broadest reasonable interpretation. The term metadata cells, as usedherein, relates to cells in the encoding region which provide necessaryor optional information about the format, version and othercharacteristics of the encoded data. By way of example, the QR-Codespecification suggests to include format information cells and versioncells, which provide information about cells or symbol characteristicsand matrix code version. This information can be used for enablingdecoding of the remainder of the encoding region.

According to examples of the presently disclosed subject matter, thevalues that are calculated for the metadata cells (or for the pixelswhich represent the derived cells) can be color and/or luminosityvalues. Further by way of example, the values for the metadata cells canbe calculated such that in addition to being associated with themetadata that needs to be encoded in the metadata cells, the values areassociated with the values set forth in the general cell specification,such that at the decode start point, the values for the derived cellsare valid according to the readable matrix code specification. Furtheraccording to examples of the presently disclosed subject matter, thevalues that are calculated for the metadata cells can also take intoaccount the appearance of the respective areas in the input image.

Throughout the description and the claims, reference is made to the term“selected cells”. The term selected cells, as used herein, relates toreadable matrix code cells which are selected from amongst the code wordcells, and the values for the selected cells are associated with apredefined message that is to be encoded in the selected cells.

According to examples of the presently disclosed subject matter, theselected cells can be a subset of the free cells, but unlike the freecells, the decode input values for the selected cells are notnecessarily based on the appearance of respective areas of the inputimage with which the readable matrix code is associated. Still furtheraccording to examples of the presently disclosed subject matter, visualperceptual similarity can be disregarded when the decode input valuesfor the selected cells are determined. However, in yet further examplesof the presently disclosed subject matter, the color and/or luminosityvalues that are calculated for the free cells can take into account theappearance of respective areas of the input image with which thereadable matrix code is associated, in addition to the predefinedmessage that is to be encoded in the selected cells, and in addition tothe general cell specification.

In examples of the presently disclosed subject matter, the values forthe selected cells can be further based on the characteristics and/orconfigurations of the scanner/reader/decoder that is/are used forprocessing, inter-alia, the areas corresponding to the selected cells inthe output image, such that the values that are assigned to the selectedcells are in compliance with the corresponding readable matrixspecification.

Thus, for example, for the selected cells, the decode input values canbe first calculated according to the message that is to be encoded inthe selected cells, and then, the values for the selected cells (e.g.,color and/or luminosity values) can be calculated based on the selectedcells' decode input values and based on a perceptual similarity to therespective areas of the input image.

Throughout the description and the claims, reference is made to theterms “visual similarity”, “perceptual similarity”, “visual perceptualsimilarity” or the like. The terms “visual similarity”, “perceptualsimilarity” or the like are known in the art of optical machine-readablecoding, and the following definition is provided as a non-limitingexample only for convenience purposes. Accordingly, the interpretationof the term “visual similarity”, “perceptual similarity”, “visualperceptual similarity” or the like in the claims, unless statedotherwise, is not limited to the definitions below and the terms “visualsimilarity”, “perceptual similarity”, “visual perceptual similarity” orthe like should be given their broadest reasonable interpretation. Theterms visual similarity or perceptual similarity relate to arelationship between an input image and an output image that includes amatrix code which corresponds to at least a portion of the input image,or to a relationship between a certain part of an input image and acorresponding matrix code which at least to a part of comparativemeasure.

According to examples of the presently disclosed subject matter, arelationship between the input image and the output image or betweencertain parts of the two images can be measured using one or more visualsimilarity measures. One example for such a visual similarity measurecan be an L-norm distance between color values of the correspondingpixels within the two images. A PSNR over MSE measure can be usedbetween the intensity levels of the corresponding pixels. Anotherexample for such a perceptual similarity measure is an L-norm distancemeasured between edge descriptors of fitting salient areas. Yet afurther example of a perceptual similarity measure that can be used isthe structural similarity index measure (SSIM), which incorporates lossof correlation, luminance distortion and contrast distortion measures.Moreover, additional computer vision techniques such as saliencydetection, object detection, object recognition can be incorporated insuch visual perception measures.

In some examples of the presently disclosed subject matter, threshold orcriteria can be used as part of the process of calculating values forcertain cells (e.g. free cells, derived cells, selected cells) and canset forth a certain level of similarity (e.g., a score) above which acell is considered to provide a target perceptual similarity to acorresponding area of an input image. Such criteria or threshold can beused to achieve a sufficient level of perceptual similarity as part ofan optimization function which searches for values that meet aperceptual similarity threshold or criterion possibly taking intoaccount other goals, constraints or targets.

Reference is now made to FIG. 1, which is a block diagram illustrationof a device for generating a readable matrix code representation image,according to examples of the presently disclosed subject matter.According to examples of the presently disclosed subject matter, adevice 100 for generating a readable matrix code representation imagecan include: a matrix code specification module 10, a functionalpatterns processing module 20 and a code-word processing module 30.

In examples of the presently disclosed subject matter, code-wordprocessing module 30 can include a free cells processing module 130 anda derived cells processing module 140. The free cells processing module130 can include a perceptual similarity evaluation module 132, and thederived cells processing module 140 can include an error correctioncalculation module 142.

An example of the operation of the device for generating a readablematrix code representation image 100 shown in FIG. 1 shall be discussedin further detail below. Before continuing with the description of thedevice for generating a readable matrix code representation image 100shown in FIG. 1, there is now provided a description of possibleimplementations of the device for generating a readable matrix coderepresentation image 100 shown in FIG. 1 on computer hardware.

According to examples of the presently disclosed subject matter, thedevice for generating a readable matrix code representation image 100 ofFIG. 1 can be implemented on a general purpose computer or on a specialpurpose computer. In another examples of the presently disclosed subjectmatter, the device for generating a readable matrix code representationimage 100 of FIG. 1 the components of the computer can be combined withcomponents of the device for generating a readable matrix coderepresentation image 100 shown in FIG. 1 to form a special purposecomputer. For example, the components of the device for generating areadable matrix code representation image 100 of FIG. 1 can be realizedby running a computer readable software code on a general purposecomputer hardware.

Reference is now made to FIG. 2, which is a block diagram illustrationof computer which may be used to generate a readable matrix code image,according to examples of the presently disclosed subject matter.According to examples of the presently disclosed subject matter, thecomputer 200 can include a communication interface 210, such as a modem,an input unit 220, such as an IO interface, a memory unit 230, such asRAM memory, and a processing unit 240, such as a CPU. The computer 200can receive an input image 205, e.g., through the cloud, and can processit to provide a readable matrix code 250, possibly in the form of adigital image, or in any other suitable form. The readable matrix code250 can be communicated to a destination, possibly a remote destinationwhich can be the source of the input image or any other remote computer,or the readable matrix code 250 can be stored locally in the computer200. As mentioned above, the computer 200 can implement the componentsof the device 100 shown in FIG. 1.

It should be appreciated that the computer shown in FIG. 2 and describedhere with reference to FIG. 2, and/or the device shown in FIG. 1 anddescribed here with reference to FIG. 1 can be a distributed device,which includes several components which reside on different devices andare controlled by a control layer as a virtual entity to perform theoperations described herein.

Reference is now made to FIG. 3, which is a flowchart illustration of amethod of generating a readable matrix code representation, according toexamples of the presently disclosed subject matter. According toexamples of the presently disclosed subject matter, the method ofgenerating a readable matrix code representation shown in FIG. 3, anddescribed herein with reference thereto, can be implemented on thedevice shown in FIG. 1 and described above with reference to FIG. 1, oron a general purpose computer, such as is shown in FIG. 2 and describedabove with reference to FIG. 2. However, it would be appreciated thatthe method of generating a readable matrix code representation that isshown in FIG. 3, and described below with reference to FIG. 3 can beimplemented on any other suitable hardware, and/or possibly on suitablehardware in combination with software which provide a special purposecomputer that is configured to perform the operations set forth in FIG.3 and described below.

According to the examples of the presently disclosed subject matterillustrated in FIG. 3, an input image and an input message that isassociated with the Input image can be obtained (blocks 305 and 310,respectively). According to examples of the presently disclosed subjectmatter, the input image 205 can be obtained via the communicationinterface 210 from a remote computer through the Internet. Further byway of example, the input message can be entered by a user of the device200 through the input unit 220. It would be appreciated that the sourceof the input image and the input message can be local or remote and canbe obtained in different ways and using different technologies. Thus,for example, the input image can be received from a first remotecomputer and the message can be received from a second remote computerthat is different from the first remote computer. In a further example,the input image and the message are received from the same source. Instill a further example, one or both of the input image and the messageare stored locally in the device where the process of generating areadable matrix code representation is implemented.

Continuing with the description of FIG. 3, in addition to the inputimage and the input message, a readable matrix code specification can beobtained (block 315). By way of example, the readable matrix codespecification can be stored in the device and can be loaded to thememory unit 230, when necessary. Still further by way of example, thereadable matrix code specification can be in the form of computersoftware instructions (or a computer software program) that is based onthe readable matrix code specification. Non-limiting examples ofreadable matrix code specifications can include, for example, thefollowing: QR-Code, EZ-Code, DataMatrix.

It would be appreciated that the process of generating a readable matrixcode representation, according to examples of the presently disclosedsubject matter, can include further inputs, such as tolerances and othercharacteristics and/or parameters which are associated with a decoder ordecoders of the matrix code. For example, certain characteristics of thehardware and/or the software that is involved in the imaging, scanningand/or decoding of the matrix code can also be provided as input to theprocess of generating a matrix code.

According to examples of the presently disclosed subject matter, afurther input which can be obtained as part of the process of generatinga matrix code can be a similarity criterion (block 320). The similaritycriterion can be, for example, a certain threshold value that iscomputed using a predefined similarity measure. Further by way ofexample, the similarity measure can be a perceptual similarity measure,and further by way of example, it can be a perceptual visual similaritymeasure. Examples of similarity measures which can be used according toexamples of the presently disclosed subject matter, include, but are notlimited to the following: L-norm distance between the color values ofthe corresponding pixels within the two images; PSNR over MSE measurebetween the intensity levels of the corresponding pixels; L-normdistance measured between edge descriptors of fitting salient areas;Structural similarity index measure (SSIM) between intensity values ofthe corresponding pixels within the two images.

It would be appreciated that according to examples of the presentlydisclosed subject matter, some of the input that was described above canbe pre-programmed into the matrix code generation process, or can bepre-stored in the device which implements the process, and it may not benecessary to obtain all the input mentioned above for each iteration ofthe process. In this regard, at least, the operations described inblocks 315 and 320 can relate to the loading of pre-programmed orpre-stored data into memory 220.

According to examples of the presently disclosed subject matter, theprocessing of the input image and input message can commence with thecalculation of the values for the function patterns of the readablematrix code. According to examples of the presently disclosed subjectmatter, the values for the function patterns can be calculated at leastaccording to the function patterns specification (block 325) in thereadable matrix code specification. As mentioned above, the readablematrix code specification can include a specification for functionpatterns, which are used to enable certain operations that are relatedto the imaging, scanning and/or decoding of the code word. For example,the function patterns can include various patterns or combinations ofpatterns that can enable a matrix code reader to identify that a certainimage contains a readable matrix code, locate the readable matrix codein the image, and configure a scanning and/or encoding process accordingto parameters indicated by the function patterns.

The values that are calculated for the function patterns can be used toinclude in the output image respective areas which are readable tocomply with the function patterns specification, as part of providing anoutput image which includes a readable matrix code. As mentioned above,the readable matrix code specification can allow some freedom withrespect to the appearance of the function patterns. In such cases, thecalculation of the values for the function patterns can implement asimilarity measure that can be used to search for values for thefunction patterns (or for at least some of the cells constitute thefunction patterns) which meet the requirements of the readable matrixcode specification, while achieving a certain level (e.g., the highestpossible) of visual perceptual similarity to respective areas of theinput image. In further examples of the presently disclosed subjectmatter, the visual perceptual similarity can be evaluated at a singlecells level, with respect to groups of cells, where each group consistsof a plurality of cells and/or over the entire image.

Further by way of example, the process of generating a readable matrixcode representation can be configured according to certaincharacteristics, configurations and/or capabilities of the imager,scanner and/or decoder (or a device which combines these functions) thatare used in the process of capturing an image of the readable matrixcode, scanning the readable matrix code and/or preparing it fordecoding. The process can be configured according to a specific deviceor module, e.g., the ones that are expected to be used in the processingof the readable matrix code, or the process of generating a readablematrix code representation can be configured according to the propertiesof a number of devices or modules, which are supported by the process.In yet further embodiments, the process of generating a readable matrixcode representation can be configured according to general properties oftypical devices or modules.

Thus, for example, the readable matrix code specification that isimplemented in the process of generating a readable matrix coderepresentation according to examples of the presently disclosed subjectmatter can be adapted and/or modified according to the characteristics,configurations and/or capabilities of the decoders, scanners or imagerswhich are supported by the process. In such cases, a range of compatiblevalues or parameters can be provided for functions patterns, which arebased on values suggested or required by the readable matrix codespecification for the function patterns. For example, the valuessuggested by the readable matrix specification for function patterns canrepresent the measures and the structure of the function patterns.

Thus, according to examples of the presently disclosed subject matter,the values for the function patterns can be calculated according to therequirements of the readable matrix code specification, possibly alsoaccording to tolerances included in the readable matrix code, and infurther examples possibly also according to tolerances, characteristics,configurations and/or capabilities of the decoders, scanners or imagers,such that the values that are calculated for the function patternsprovide a certain level (e.g., the highest possible) of visualperceptual similarity to respective areas of the input image, whilemeeting, de-facto, following imaging, scanning, processing, therequirements of the readable matrix code specification. Examples ofvisual perceptual similarity measures, and of a process of evaluatingvisual perceptual similarity are described below and can be implementedhere for evaluating visual perceptual similarity between areas in theoutput image which correspond to function patterns and correspondingareas in the input image.

Continuing with the description of FIG. 3, according to examples of thepresently disclosed subject matter, at block 330 the code wordprocessing module 30 may be utilized to determine, based on the codeword specification, an extent of each of the free cells and the derivedcells in the readable matrix code that is to be generated. In someexamples of the presently disclosed subject matter, the extent of eachof the free cells and the derived cells can be selected by a user. Itwould be appreciated that in some cases, it is sufficient to determineor select the extent of just one of the cell types (free or derived),and the extent of the other one is directly derivable. It would be alsoappreciated that according to examples of the presently disclosedsubject matter, block 330 is optional and the process of generating areadable matrix code representation can be preconfigured with apredefined setting for the extent of one or both of the free cells andthe derived cells that is to be included in the readable matrix code. Itwould be also appreciated that a visual perceptual measure and methodprocess that is based on a visual perceptual measure and a criterionwhich corresponds with the visual perceptual measure can be implementedfor determining an extent of each of the free cells and the derivedcells in the readable matrix code that is to be generated.

Next, values for the free cells can be calculated. According to examplesof the presently disclosed subject matter, the values for the free cellscan be calculated such that the appearance of the free cells compared torespective areas of the input image complies with a visual perceptualsimilarity criterion (block 335). As mentioned above, according toexamples of the presently disclosed subject matter, the calculation ofthe values for the free cells takes into account, in addition to thevisual perceptual similarity measure, the general cell specificationfrom the readable matrix code specification. According to furtherexamples of the presently disclosed subject matter, the general cellspecification can be common to any cell or pattern (which is a group ofcells) and is thus applied for any cell in the readable matrix code.

According to examples of the presently disclosed subject matter, themessage which is to be encoded in the readable matrix code can be aspecific message and the values for the free cells are calculatedfurther based on the message, such that the message can be read from thereadable matrix code, e.g., by decoding the readable matrix code. Stillfurther by way of example, the message can be an input from a user orcan be received from any other source.

The message may be required to meet a set of basic rules, which, forexample, can define the sort of data that can be included in themessage, the maximum length of the message etc.

In some examples of the presently disclosed subject matter, the valuesfor the free cells are calculated based on the readable matrix codespecification and further based on the input message that is to beencoded in the readable matrix code.

In other examples of the presently disclosed subject matter, the messagethat is encoded in the readable matrix code is not taken into account inthe calculation of the values of the matrix code, including in thecalculation of the values for the free cells, and whichever message thatresults from the process of generating a readable matrix can be used. Itwould be appreciated that in such cases the message can reflect thevalues which provide the best or near best visual perceptual similarityto the input image.

In still further examples of the presently disclosed subject matter,part of the readable code matrix can be used to encode a certainmessage, and part of the readable code matrix is not bound by anyspecific message. In this case, there is more freedom in some areas ofthe readable code matrix, which are not bound to provide certain data inthe decoded bit stream, relative to other areas in which the values ofthe readable matrix code are required to represent specific data.

As was also mentioned above, the readable matrix code specification caninclude some tolerances. By way of example, the tolerances in the caseof free cells can be tolerances that are applicable to the general cellspecification. According to examples of the presently disclosed subjectmatter, the applicable tolerances can be implemented as part of thecomputation of the values for the free cells. Thus, according toexamples of the presently disclosed subject matter, the computation ofthe values for the free cells can include computing a value for eachcell or for each group of cells (consisting of 1, 2, . . . , n cells)according to a visual perceptual similarity measure and according to thefree cells specification (e.g., the general cell specification),including, if applicable, any tolerances which are supported by thereadable matrix code specification, and possibly also according to aninput message.

According to yet further examples of the presently disclosed subjectmatter, and as was mentioned above, the readable matrix codespecification that is implemented in the process of generating areadable matrix code representation, can be configured according tocertain characteristics, configurations and/or capabilities of thedecoders, scanners or imagers (and devices which combine thesefunctions) that are used in the process of capturing an image of thereadable matrix code, scanning the readable matrix code and/or preparingit for decoding. Thus, for example, the general cells specificationwhich is used in the calculation of the free cells can be adapted and/ormodified according to the characteristics configurations and/orcapabilities of the decoders, scanners or imagers.

Thus, according to examples of the presently disclosed subject matter,the values for the free cells can be calculated according to thesuggestions/requirements of the readable matrix code specification, andsuch that the appearance of the free cells compared to respective areasof the input image complies with a visual perceptual similaritycriterion. The values for the free cells can be calculated furtheraccording to the tolerance parameters which are set forth by thereadable matrix code specification and/or according to parameters thatrelate to characteristics, configurations and/or capabilities of thedecoders, scanners or imagers, and/or according to an input message thatis to be encoded in the readable matrix code (if applicable). Thus, insome examples of the presently disclosed subject matter, the values forthe free cells can be calculated such that the areas in the output imagewhich represent the free cells provide a certain level (e.g., thehighest possible) of visual perceptual similarity to respective areas ofthe input image, while meeting, de-facto, at the decoder, therequirements of the readable matrix code specification.

According to examples of the presently disclosed subject matter, thecalculations which are implemented as part of the process of generatinga readable matrix, and which involve implementing a visual perceptualsimilarity measure, can include an optimization algorithm. Further byway of example, for a given cell or group of cells, the optimizationalgorithm can be used to find a value which meets the requirement toprovide a readable matrix code and which provides a good (e.g., thebest) visual perceptual similarity between the respective area of theoutput image that is rendered according to the selected value and thecorresponding area from the input image.

According to examples of the presently disclosed subject matter, themessage which the readable matrix code has encoded therein can beselected such that the best visual perceptual similarity is achievedbetween the input image and the output image representing the readablematrix code.

In further examples of the presently disclosed subject matter, thereadable matrix code is required to include a specific message, and theencoding or the readable matrix code can be configured to take intoaccount the message that needs to be encoded.

In some example, the message uses the entire extent of free cells in thereadable matrix code, and thus all the computations of the free cellstake into account the message that needs to be encoded in the readablematrix code.

In further examples, the message can be encoded using only some of thefree cells, and the calculation of the values for the remaining freecells is not bound by a specific message. In such cases, there isfreedom with regard to the message to be encoded in the readable matrixcode. For instance, when the message that needs to be encoded in thereadable matrix code is some prefix (e.g., a URL) and a substantiallyunique key, the prefix is the specific message that needs to be encodedin the readable matrix code, for example, at a specific region of thecode, and the substantially unique key can be selected based on visualperceptual similarity to the respective areas of the input image. Itwould be appreciated that in such cases the calculation can seek toprovide the best (or near best) visual perceptual similarity in theareas where the encoded message is not dictated, and there is asubstantial or relatively great freedom to select cell values. In stillfurther examples of the presently disclosed subject matter, the key isencoded in the selected cells together with the prefix.

In some examples of the presently disclosed subject matter, thecalculation of the values for the free cells can include a feature whichcan be used to slightly modify the key which results from thecalculation, when there is already an existing readable matrix codewhich uses the same key. It would be appreciated that slightmodification can be made without having a substantially adverse effecton the visual perceptual similarity.

Thus, according to examples of the presently disclosed subject matter,the visual perceptual similarity measure can be used at different stagesof the calculation of a value for a given free cell (and possibly in thecalculation of values for other cells). According to examples of thepresently disclosed subject matter, the visual perceptual similaritymeasure calculation can be used for computing the pixel values for theinput image, for example, using an optimization function or aconstrained optimization function that is based on a MSE between thepixel color values in the output message which represent the readablematrix code and the corresponding pixel color values in the input image,and the constraint can limit the search to a certain, e.g., predefined,color range. This calculation can be implemented as a superimposition ofa given matrix code on the image. It would be appreciated that thiscomputation may be carried out for both the specific input messagesreadable matrix code type, the “free” message readable matrix code type,and a combination matrix code that combines an input message and a“free” message, which were all described above.

According to examples of the presently disclosed subject matter, in casethe process of generating a readable matrix code is not bound or ispartially not bound by an input message, or in other words, if there isfreedom with regard to the encoded message to be encoded in the readablematrix code the visual perceptual similarity measure can be used, forexample, to determine the decode input value of the cells which are notbound by an input message. In further examples of the presentlydisclosed subject matter, in case the process of generating a readablematrix code is not bound or is partially not bound by an input message,the visual perceptual similarity measure can be used, for example, todetermine the color values of pixels in the output image whichcorrespond to a cell in a readable matrix code. It would be appreciated,that the term encoded message as used herein relates to the entire datathat is encoded in the data cells, which can include, for example, theinput message, and possibly also padding characters.

There is now provided an example of the use of a visual perceptualsimilarity measure for determining a decode input value of a cell,according to examples of the presently disclosed subject matter.According to examples of the presently disclosed subject matter, avisual perceptual similarity measure can be used to determine the decodeinput value of a certain free cell as follows: quantifying pixels colorvalues over an area of the input image with which the free cell isassociated; estimating a visual similarity between the pixels colorvalues and each of a dark color value and a light color value; anddetermining the decode input value based on the score of the visualsimilarity estimation. For example, select the decode input value suchthat the corresponding cell will be decoded as the color value (dark orlight) with the smaller MSE, according to the readable matrix codespecification.

There is now provided an example of the use of a visual perceptualsimilarity measure for determining color values of pixels in the outputimage which correspond to a cell of a readable matrix code, according toexamples of the presently disclosed subject matter. According toexamples of the presently disclosed subject matter, the color values ofthe pixels in the output image which correspond to a cell of a readablematrix code can be determined using a visual perceptual similaritymeasure, an optimization function, and a decode input value of the cell.These attributes can be considered as an optimization algorithm thatcan, for example, be used to calculate the color values of the pixels inthe output image which correspond to a cell of a readable matrix codesuch that the pixels in the output image will have high visualsimilarity to the corresponding area of the input image, and its decodeinput value will be, with high probability, valid when read by ascanning device.

An example of an optimization algorithm which can be implemented as partof a process of generating a readable matrix code representationaccording to examples of the presently disclosed subject matter is nowdescribed. In the example below two values or two sets of values (or onevalue and one set of values) can be computed for a given cell of thereadable matrix code, simultaneously or one by one. The first value canrepresent the decode input value of the cell of the readable matrix code(for example dark or light). The second set of values can include colorvalues of pixels in the output image which correspond to the cell of thereadable matrix code. The representation of the matrix code in theoutput image, according to the colors computed for each cell or area inthe matrix code can provide part of the readable matrix code (whenscanned and processed by a suitable scanning device).

Formula 1 provides a mathematical representation of an example of acomputation that can be implemented as part of the process of generatinga readable matrix code representation, according to examples of thepresently disclosed subject matter:(Pixels'Colors)=argmin_(Colors)(alpha·MSE(Colors InputColors)−beta·Range(decode input value,Colors)  Formula (1)where “Input Colors” denote the color values of pixels of the inputimage which correspond to the cell of the readable matrix code for whichthe computation is performed, “decode input value” r is the decode inputvalue of the cell, and “Pixels' Colors” are the color values of thepixels of the output image; argmin_(p)(F)—is a known optimization markfor an optimization function that searches for an argument that yieldsthe minimum value for the target function F, while altering theparameter p; alpha and beta are optional weighting factors that can beused to increase or decrease the weight of the parameters involved inthe calculation to control, for example, the level similarity orreliability which the calculated value provides; decode input value isthe value that is selected or calculated for the cell of the readablematrix code according to the readable matrix specification. The decodeinput value can be specified, or it can be calculated using formula (1).For example, the optimization problem of formula (1) can be solvedtwice, once for each possible decode input value (and if more than twodecode input values are used, the optimization problem is solved foreach value). The decode input value which produced a lower target value(or higher, depending on the implementation of the optimization problem)can be selected as the decode input value for the cell, for example, toallow a relatively high visual similarity between the correspondingareas of the output image and the input image; Range( ) denotes afunction which determines whether the pixels values are within anallowed range of values. For example, the Range( ) function can beconfigured to return a grade of ‘0’ if a color is in the range, or ‘1’if the color is outside the range. The beta factor can be used tomultiple the Range result by some weighting factor. However in furtherexamples of the presently disclosed subject matter, a smooth functionbetween 0-1 or even between a X-Y can be used for the range.

According to examples of the presently disclosed subject matter, inFormula 1 the mean square error (also referred to herein in abbreviation“MSE”) algorithm is used to evaluate the visual perceptual similarityamong the area in the input image and the respective area in the outputimage which corresponds to a readable matrix cell. It would beappreciated that many other visual perceptual similarity algorithms canbe used in the search for the value that is to be given to the variousreadable matrix cells. For example, another option is to use the peaksignal to noise ratio (also referred to herein by the abbreviation“PSNR”) algorithm.

In still further examples of the presently disclosed subject matter, theprocess can be implemented with any one of a plurality of visualperceptual similarity algorithms and the algorithms that are used for agiven readable matrix code can be selected on an ad-hoc basis, or theselection can be according to the type or any other feature orcharacteristic of the input image, of the output image, and/or of thedesired readable matrix code. Still further by way of example, theselection can be a manual selection, by a user input.

In yet further examples of the presently disclosed subject matter, thevisual perceptual similarity algorithm that is used in the calculationof the values for the readable matrix cells can be adapted and or can becombined with other algorithms, including algorithms that are notin-and-of-themselves visual perceptual similarity algorithms.

In yet a further example, the calculation of the value for a given cellcan be configured such that the value is calculated further inaccordance with the values or characteristics of other cells, such asneighboring cells. For example, the calculation of the value for a givencells can include measures of the average illuminant value of the pixelsin the cell and in neighboring cells, and this measure can be taken intoaccount when calculating the value for the cells. A calculation that isbased on this example can be combined with the MSE calculation mentionedabove.

In yet a further example, the calculation of the value for a given cellcan include a quantification algorithm that can be used to quantize thecolors in the image into two colors, e.g., dark or light, even in caseswhere the image is all dark or all light.

Continuing now with the description of FIG. 3, following the calculationof the value for the free cells, the values which form the derived cellscan be calculated (block 340). As mentioned above, according to thereadable matrix code, a code word includes free cells and derived cells.According to examples of the presently disclosed subject matter, thederived cells can be cells whose values are based on the values ofcorresponding free cells.

By way of example, the free cells are data cells and the derived cellscan be error corrections cells. However, as mentioned above, dependingon the type of error correction mechanism that is used in the readablematrix code (according to the corresponding readable matrix codespecification), the free cells can include error correction cells andthe derived cells can include data cells. In such cases, data cells arereplaced by error correction cells in the free cells and the data cellsbecome derived cells. This means that in such cases, the values for(some or all) the error correction cells can be computed such that theappearance of the error correction cells, compared to respective areasof the input image, complies with a visual perceptual similaritycriterion, and the values of the corresponding data cells are computedbased on the values that were calculated for the error correction cells.

Referring back to FIG. 1, in case the free cells are data cells and thederived cells are error correction cells, free cells processing module130 can be configured to process the data cells, and derived cellsprocessing module 140 can be configured to process the error correctioncells. The free cells processing module 130 can be configured to use thevisual perceptual similarity evaluation module 132 to calculate valuesfor the free cells, such that the appearance of the free cells comparedto respective areas of the input image complies with a visual perceptualsimilarity criterion. The derived cells processing module 140 can beconfigured to use the error correction calculator module 142 tocalculate values for the derived cells according to the code wordspecification and based on the values of the free cells. It would beappreciated that the free cells processing module 130 can be fed withdata cells or with error correction cells and in case at least some ofthe free cells are error correction cells, the values for the errorcorrection cells can be computed according to the code wordspecification and such that the appearance of such error correctioncells compared with respective areas of the input image meets a visualperceptual similarity criterion. The corresponding data cells can be fedto the derived cells processing module 140, and the error correctioncalculator module 142 can be used to calculate values for the deriveddata cells according to the code word specification and based on thevalues of the corresponding error correction free cells.

After the values for the function areas, the values for the free cellsand the values for the derived cells are calculated, the input image andeach of the calculated function patterns values, the values calculatedfor the free cells, and the values calculated for the derived cells canoptionally be fused with the input image to form a readable matrix code(block 345). Fusing the values for the cells and patterns with the inputimage as used herein relates to a process which, according to examplesof the presently disclosed subject matter, receives as input the valuesfor the function areas, the values for the free cells and the values forthe derived cells, and the corresponding parts of the input image andmodifies the pixel values of the corresponding areas of the input image,such that the average illuminant/lightness that are used by the decoder,after the regions of the fused image are captured by the reader, areconverted to pixel values following processing by an image processingmodule and the pixels values are processed by the decoder (if suchprocessing takes place), which enables the decoder to decode therelevant part(s) of the image as a readable matrix code.

In another example, the decode input value and the color values of thepixels of the output image, which correspond to a cell of the readablematrix code, particularly in respect of a free cell, can be computedusing a single computation. For example, as previously described, usingFormula (1), the decode input value for a free cell can be computedtogether with pixel color values.

According to examples of the presently disclosed subject matter, aregion in the fused image, which represents a readable matrix code cell,can be a pixel, or a group of pixels. A pattern (e.g., a functionpattern) in the fused image is represented by a group of pixels.

According to examples of the presently disclosed subject matter, thefusing operation or process can involve implementing a visual perceptualsimilarity measure to calculate a value for one or more of: the functionpatterns, the free cells, the derived cells, and other types of cellsthat are used in the process of generating a readable matrix coderepresentation according to examples of the presently disclosed subjectmatter (e.g., selected cells which will be discussed below). Accordingto examples of the presently disclosed subject matter, the visualperceptual similarity calculations that are implemented as part of thecalculations of the function patterns, the free cells, the derivedcells, and any other types of cells that are used in the process ofgenerating a readable matrix code representation, can be performed atthe cell or pattern level, which means that if the cell or pattern isassociated with a group of pixels (and not just a single pixel), thevalue that is calculated for a given cell can be applied to each pixelthat is associated with the cell. Further by way of example, thecalculations that are carried out as part of the fusing operation can beat the sub-cell level. For example, if each cell of the readable matrixcode is associated with a group of pixels (e.g.: with 2, 3, . . . , npixels) in the output or fused image, the computation can be at the celllevel, or at the sub-cell level, for example, at the pixel level.

Furthermore, the calculation of the values for the free cells at block335, which involves applying a visual perceptual similarity measure, todetermine, based on visual perceptual similarity to the input image andbased on the readable matrix specification (or more specifically thecode-word specification from the readable matrix specification) caninvolve a basic similarity measure, such as SSIM or PSNR, or thecomputation can be more complex and involve additional measures,including some or all of the measures which are described here as beingimplemented as part of the fusing operation, and which are applicable tocomputations at the cell level (and are not sub-cell levelcomputations). Similarly, visual perceptual similarity measures whichare implemented in the cell level, including for example one or more ofthe visual perceptual similarity measures described herein withreference to the fusing operation, can be carried out as part of thecomputations of the values for the function patterns, of the values forthe derived cells, and/or as part of the computation of values for othertypes of cells that are used in the process of generating a readablematrix code representation according to examples of the presentlydisclosed subject matter (e.g., selected cells which will be discussedbelow). Thus, it would be appreciated that some of the visual perceptualsimilarity measures described herein can be implemented at differentstages and as part of different operations which are carried out as partof the process of generating a readable matrix code representation, andthe decision when to use a certain computation can be based, forexample, on design preferences.

Returning now to the description of the fusing operation (block 345),there are provided below, in accordance with some examples of thepresently disclosed subject matter, a description of some computationswhich can be implemented as part of the fusing operation. It will beappreciated that the fusing operation can include one or more of thebelow described computations.

As part of the fusing operation, the input image can be copied to memory(e.g., to memory unit 230). For convenience, the image which resides inthe memory and that is processed as part of the fusing operation shallbe referred to herein as the “temporary image”. It would be appreciated,that all the images referenced in the description of examples of thepresently disclosed subject matter, can be in the form of digital datathat is stored on a tangible computer readable medium.

According to examples of the presently disclosed subject matter, furtheras part of the fusing operation, luminance fusing thresholds can bedefined or calculated. Still further by way of example, two luminancefusing thresholds can be defined, a dark-threshold and alight-threshold. Yet further by way of example, and for illustrationpurposes, in a luminance scale of [0,255] a dark-threshold upper boundcan be a value in the order of 80 and a light-threshold lower bound canbe in the order of 170. Still further by way of example, the luminancevalues can be provided as Lab channels. A Lab color space is acolor-component space with dimension L for lightness and a and b for thecolor-component dimensions, based on nonlinearly compressed CIE XYZcolor space coordinates.

According to further examples of the presently disclosed subject matter,a global threshold can be determined by taking areflectance/intensity/luminance value midway between the maximumreflectance/intensity/luminance and minimumreflectance/intensity/luminance of a certain image (e.g., the temporaryimage) or part of it. The global threshold for the temporary image canbe calculated, and the computation of the luminance fusing thresholdscan be calculated subsequently, based on the calculated globalthreshold. For example, the luminance fusing thresholds can becalculated such that that there will be a gap between the globalthreshold and the luminance fusing thresholds. The purpose of the gap isto enable a decoder to decode the cells with high probability as validmatrix code cells and with the correct value, according to a readablematrix code specification and/or implementation (possibly after opticalreading and signal processing and any further processing that may takeplace before decoding).

According to examples of the presently disclosed subject matter,following the computation of the luminance fusing thresholds, for eachpixel in the temporary image, the luminance value of the pixel can beshifted according to a selected one from the luminance fusingthresholds. For example, if a luminance value for a given pixel is belowthe global threshold, the dark-threshold can be applied to the pixelvalue, and the luminance value for the pixel can be shifted accordingly.Shifting relates to any allowed operation on a pixel, such as add orsubtract a value to or from the pixel's value.

According to further examples of the presently disclosed subject matter,the global threshold for the temporary image is initially a provisionalglobal image. The provisional global image can be re-evaluated aftereach of one or more pixel shifting operations, and based on the resultsof the re-evaluation, the global threshold can be updated. For example,the re-evaluation of the provisional global threshold can includere-sampling the maximum reflectance and minimum reflectance of thetemporary image. Further by way of example, the computation of theupdated provisional global threshold can include re-computing the midwayvalue between the maximum reflectance and minimum reflectance.

According to examples of the presently disclosed subject matter,following completing of the pixel shifting operation (in one or moreiterations), the computed luminance values for all the pixels can beused to convert the temporary image to a desired color representation,and copying the temporary image into the output image.

In a further example of the presently disclosed subject matter,following the copying of the input image to the memory, and thecomputation of the luminance fusing thresholds, for example, as wasdescribed above, the fusing operation can further include, segmentingthe temporary image into spatial cells based on the readable matrix codespecification, and for each region which corresponds to a cell (based onthe readable matrix specification) in the temporary image, the averageluminance value of the cell can be shifted according to the luminancefusing threshold that is appropriate according to the average luminancevalue of the cell. Thus, for example, if the average luminance value ofa given cell is below the global threshold (e.g., this is a “dark”cell), the average value of the cell is shifted according to the darkluminance fusing threshold.

According to examples of the presently disclosed subject matter,shifting the average luminance value of the cell can include, forexample, shifting a sub-group of pixels of the entire group of pixelsthat belong to the cell. Hence, for example, if the value that wascomputed for the cell as part of the process of generating a readablematrix code indicates that the cells are dark (e.g., below the globalthreshold), this necessitates shifting some of the pixels that areassociated with the cell, and maintaining others at the computed value(or at least shifting to a different extent or even making them“lighter”) according to the process of generating a readable matrix coderepresentation, such that the average for the cell drops below thethreshold.

According to further examples of the presently disclosed subject matter,the shifting operation can be based on a shifting value, whichcorresponds to a difference between the average value and theappropriate global threshold of the corresponding matrix code cell.Further by way of example, the shifting operation can include shiftingall the pixels that are associated with a given cell by the calculateddifference value, while clipping values of the pixels under (for darkcells) the minimum presentable value. For example in the [0,255] range,which is a common range for many color channels, any shift that wouldresult in a value that is under 0 (a negative values) can be clipped to0. The clipping operation can interfere with the process of averaging avalue of a cell to below (or above) a certain threshold, and thereforeaccording to examples of the presently disclosed subject matter,clipping should be considered when determining the difference value. Ina further example, the effect of clipping can be evaluated after theshifting process, and a second shifting process can be implemented toovercome the clipping effect.

According to yet further examples of the presently disclosed subjectmatter, considering the QR Code specification as an example, theshifting values can be computed using an optimization function thattakes into account: (a) a visual similarity measure between thecorresponding cell/pixels within the input and the temporary images; and(b) a readability measure for a given cell and a given light or darkthreshold. Further by way of example, the altering arguments of theoptimization function can be the luminance or color values of the pixelsof the cell. Such an optimization function can be similar to thefunction presented in Formula (1), where the readability function is thementioned Range function. In general, a readability function is afunction that (a) gives high grades to color values which enables adecoder to decode the cells with low probability as valid and with thecorrect value, according to a readable matrix code specification and/orimplementation (possibly after optical reading and signal processing andany further processing that may take place before decoding) and (2)gives low grades to colors which enables a decoder to decode the cellswith high probability as valid and with the correct value, according toa readable matrix code specification and/or implementation (possiblyafter optical reading and signal processing and any further processingthat may take place before decoding). Thus, the suggested functionencourages the mentioned optimization function to choose colors withhigh probability to be scanned and decoded correctly, while theoptimization function also considers the visual similarity measures.

For example, a visual similarity measure can be a L2 norm between thetemporary luminance value and the input luminance value. The readabilitymeasure can be a sigmoid function penalizing temporary color values farand away from regions that contain colors values that enable a decoderto decode the cells with low probability as valid and with the correctvalue, according to a readable matrix code specification and/orimplementation, and encouraging temporary color values to be assignedwith color values that enables a decoder to decode the cells with highprobability as valid and with the correct value, according to a readablematrix code specification and/or implementation.

According to examples of the presently disclosed subject matter, theoptimization function can also include a weight parameter. The weightparameter can be used to weight the importance of the two suggestedmeasures, which are (a) a visual similarity measure between thecorresponding cell/pixels within the input and the temporary images; and(b) a readability measure for a given cell and a given light or darkthreshold, according to a predefined setting, such as the demands of acertain application, or according to a manual selection by an operator.

According to yet further examples of the presently disclosed subjectmatter, the shifting value can be computed using the optimizationfunction that was mentioned above, and further taking into account inthe optimization function the appearance of neighboring cells and thevisual effect of neighboring cells on the appearance and the visualsimilarity of each cell. Further by way of example, the neighboringcells can include any number of cells and are not necessarily limited tothe cells that have a common edge with the cell to which theoptimization function is being applied, in this regard, by way ofexample, the optimization function can even take into account the entireimage.

Reference is now additionally made to FIG. 4, which is a graphicalillustration of a fusing operation according to examples of thepresently disclosed subject matter. For convenience, the fusingoperation shown in FIG. 4 is made with respect to a relatively smallregion, which represents the input image (this region is referenced 62)and a representation of an area of a readable matrix code that isgenerated according to the matrix code specification, the input messageand using the method of generating a readable matrix code according toexamples of the presently disclosed subject matter (this area isreferenced 61).

In FIG. 4, the matrix code cells 61 represent a possible 2×2 data cell.However it would be appreciated that the process described herein belowwith reference to FIG. 4 can be readily expanded to the entire image andreadable matrix code. It would be appreciated that the matrix code cells61 shown in FIG. 4 represent the appearance of the readable matrix codewhich can be generated based on the readable matrix code specification,without taking into account the input image or any of the other factors(such as the tolerances, characteristics, configurations and/orcapabilities of the decoders, scanners or imagers) that were discussedabove. Nevertheless, as can be seen in FIG. 4, the matrix denoted by thenumeral 61 presents a relatively high visual similarity to the inputimage 62 as a result of an implementation of the method of generating areadable matrix code according to examples of the presently disclosedsubject matter. The fusing process can take advantage of the computeddecode input values in the matrix denoted by the numeral 61 towards amore efficient fusing process, in terms of performance and/or in termsof the quality (level of visual perceptual similarity) of the fusedimage.

According to examples of the presently disclosed subject matter, thefusing operation in FIG. 4 receives as input the matrix codespecification cells 61 and the input image 62. The fusing module 63 canbe configured to implement an algorithm which creates an image 64 whichcan be saved in a new location in the memory, or can replace the matrixcode cells 61 or the input image 62 in the memory. The image 64resulting from the fusing operation can be the output image of theprocess of generating a readable matrix code representation, and in sucha case can replace in memory the matrix code cells 61 or the input image62. However in further examples of the presently disclosed subjectmatter, the temporary image 64 can be an intermediate image in case thefusing operation includes multiple iterations (two, three, . . . , niterations), and in such cases it may be necessary to maintain inmemory, in addition to the temporary image 64, the matrix codespecification cells 61 or the input image 62, to enable furtherprocessing of the temporary image and further iterations of the fusingoperation.

According to examples of the presently disclosed subject matter, takingadvantage of the tolerances included in the readable matrix code, and/ortaking advantage of tolerances, characteristics, configurations and/orcapabilities of the decoders, scanners or imagers, a cell in the outputimage 64, which represents a cell of a readable matrix code, can beinterpreted with the same value as the respective value of the matrixcode specification cells 61, if a certain amount of pixels in the cellare assigned with intensity values that pass a certain threshold,defined by the readable matrix code specification, and implemented bythe scanner. For example in the QR Code specification such a thresholdis the global threshold, while de facto few scanners implement with highaccuracy the suggested criterion, while others define a similarcriterion using, as an example, a semi-global global threshold, meaninga global threshold per region.

According to examples of the presently disclosed subject matter, for areadable matrix code cell, the fusing module 63 can be configured toassign a group of pixels in the output image 64 (or in the temporaryimage) with values that are expected to enable a decoder (possibly afteroptical reading and signal processing and any further processing thattakes place before decoding) to decode the cell as a valid cell of areadable matrix code (regardless of the value of other pixels in thecell). Further by way of example, the group of pixels of the cell whosevalues enable a decoder to read the cell as a valid cell of a readablematrix code constitute only part of the cell's pixels, and still furtherby way of example, the rest of the cell's pixels can be assigned withthe value of the respective pixels in the input image 62. By way ofexample, center pixels of each cell can be assigned with values close tothe value of the respective in the matrix code region 61. These valuescan be, for example, the average of the values of neighboring pixels inthe input image 62 that are considered to present a higher level ofvisual similarity to the respective values in the matrix code region 61.This latter computation differs from the computation that was used togenerate the cell 65, in which the center pixels of the cell wereassigned with the value of the respective cells in the matrix coderegion 61.

Reference is now additionally made to FIG. 5, which is a graphicalillustration of a fusing operation according to examples of thepresently disclosed subject matter. For convenience, the fusingoperation shown in FIG. 5 is made with respect to a relatively smallregion, which represents the input image (this region is referenced 67)and a representation of an area of a readable matrix code that isgenerated strictly according to the matrix code specification and theinput message (this area is referenced 66). In FIG. 5, the matrix codecells 66 each represent a possible 2×2 data cell. However it would beappreciated that the process described hereinbelow with reference toFIG. 5 can be readily expanded to the entire image and readable matrixcode. It would be appreciated that the matrix code cells 66 shown inFIG. 5 represent the appearance of the readable matrix code which can begenerated based on the readable matrix code specification, withouttaking into account the input image or any of the other factors (such asthe tolerances, characteristics, configurations and/or capabilities ofthe decoders, scanners or imagers) that were discussed above.Nevertheless, as can be seen in FIG. 5, the matrix denoted by thenumeral 65 presents a relatively high visual similarity to the inputimage 66 as a result of an implementation of the method of generating areadable matrix code according to examples of the presently disclosedsubject matter. The fusing process can take advantage of the computeddecode input values in the matrix denoted by the numeral 65 towards amore efficient fusing process, in terms of performance and/or in termsof the quality (level of visual perceptual similarity) of the fusedimage.

According to examples of the presently disclosed subject matter, thefusing operation in FIG. 5 receives as input the matrix codespecification cells 66 and the input image 67. The fusing module 68 canbe configured to implement an algorithm which creates an image 69 whichcan be saved in a new location in the memory, or can replace the matrixcode specification cells 66 or the input image 67 in the memory. Theimage 69 resulting from the fusing operation can be the output image ofthe process of generating a readable matrix code representation, and insuch a case can replace in memory the matrix code specification cells 66or the input image 67. However in further examples of the presentlydisclosed subject matter, the temporary image 69 can be an intermediateimage in case the fusing operation includes multiple iterations (two,three, . . . , n iterations), and in such cases it may be necessary tomaintain in memory, in addition to the temporary image 69, the matrixcode specification cells 66 or the input image 67, to enable furtherprocess of the temporary image and further iterations of the fusingoperation.

According to examples of the presently disclosed subject matter, and inaccordance with previous explanation, taking into account the tolerancesincluded in the readable matrix code, and/or taking into account thetolerances, characteristics, configurations and/or capabilities of thedecoders, scanners or imagers, a value of a cell which is represented bypixels in the output image 69, can be determined using a threshold whichis set forth in the matrix code cells 66 (and which is implemented bythe reader device), even if part of the pixels are above the thresholdand other pixels which are also associated with the cell are below thethreshold. As an example of such a threshold, in the QR Codespecification a global threshold is specified, and the pixels values canbe evaluated using the global threshold. Further by way of example, thevalue of a cell can be determined according to the value of a majorityof the pixels, and not all the pixels which are associated with areadable matrix code cells must have the same relation with the globalthreshold.

In further examples of the presently disclosed subject matter, takinginto account the tolerances, characteristics, configurations and/orcapabilities of the decoders, scanners or imagers can include, forexample, implementing a semi-global threshold or a regional threshold,such that the global threshold suggested by the readable matrix codespecification is adapted per region, for example, according to visualand/or optical characteristics of the region and/or of neighboringregions.

According to examples of the presently disclosed subject matter, a copyenable algorithm which can be implemented according to examples of thepresently disclosed subject matter, can be used to determine if a cellvalue which enables a decoder to decode the cell with high probabilityas valid and with the correct value, according to a readable matrix codespecification and/or implementation (possibly after optical reading andsignal processing and any further processing that may take place beforedecoding) can be the same as the value of the corresponding area in theinput image, such that the area from the input image can be copied tothe output image without any modification. Thus, when it is determinedaccording to the copy enable algorithm that an area from the input imagecan be copied to the output image, the respective pixels' values fromthe input image 62 can be simply copied to the corresponding areas inthe output image 64 (or to the temporary image).

Resuming now the description of possible fusing operationimplementations, in yet a further example of the presently disclosedsubject matter, following the copying of the input image to the memory,and optionally converting the image to Lab image representation, andafter segmenting the temporary image into spatial cells based on thereadable matrix code specification, for each region which corresponds toa cell (based on the readable matrix specification) or to a certaingroups of cells consisting of a certain number of neighboring cells inthe temporary image, a semi-global threshold can be computed that takesinto account only the cell or group of cells and a certain number ofneighboring cells. The luminance fusing thresholds can then be computed,for example the light and dark fusing thresholds that were mentionedabove, based on the semi-global threshold that were calculated for thecells or for the cell groups. By way of example, the light and darkfusing thresholds can be calculated to have a safe distance for thesemi-global thresholds. In this example, the fusing thresholds arecomputed for each cell or for each group of cells.

Subsequently, according to examples of the presently disclosed subjectmatter, the luminance values of the cells can be shifted, for example,according to any one of the shifting operations that were describedabove which are adapted to use the cell or group of cells fusingthresholds. For the sake of illustration, the results can be provided asLab channel values. The temporary image can be converted to the desiredcolor representation, and can be copied to provide the output image.

According to a further example, the fusing operation can include copyingthe input image to memory while converting the input image to HSV imagerepresentation. The image in the memory shall be referred to herein asthe temporary image.

Further by way of example, two color ranges can be defined: a dark-rangeand a light-range. Still further by way of example the range can beselected to match requirements of a CMYK representation of the resultingoutput image. Still further by way of example, the range can be selectedaccording to a criterion that is based on a high probability measure ofa likelihood that a printed version of the output image can have asmaller color MSE distance to the digital image. For example in an HSVscale of [0,100]^3 the dark-range can be selected as [S,V]<[25,25] upperbound, and a light-range can be selected [S,V]>[85,85]. In anotherexample, the current global threshold of the temporary image can befirst calculated, and subsequently the light and dark ranges can becomputed according to valid dark and light ranges. In yet anotherexample, the [S,V] pairs denote an upper and a lower bound, and theupper and lower bounds define a range, as explained above, which can becomputed as a function of H.

According to further examples of the presently disclosed subject matter,the fusing operation can include: for each pixel in the temporary imagecompute its HSV value by both (1) choosing an HSV value within an HSVcolor range, which enables a decoder to decode the cell with highprobability as valid and with the correct value, according to a readablematrix code specification and/or implementation (possibly after opticalreading and signal processing and any further processing that may takeplace before decoding), and (2) choosing the closest value within thesaid range which is the closest to the HSV value of the correspondingpixel in the input image. For example, in QR Code, such ranges shouldrepresent either dark or light. The measure for defining such distancesbetween colors, in order to compute the said closest value, can be forexample, any L norm distance. Thus, for example, if the value of thepixel's corresponding matrix code cell is dark, then the pixel's HSVvalue can be shifted into the dark-range; and if the value of thepixel's corresponding matrix code cell is light, then the pixel's HSVvalue can be shifted into the light-range. The resulting values can beused to update the temporary image, the temporary image can optionallybe converted to any desired color representation, and the temporaryimage can be copied to give rise to the output image.

It would be appreciated that this implementation of the fusing operationcan also be implemented at the cells level rather than at the pixellevel as was already described above with respect to other computations.

According to examples of the presently disclosed subject matter,following completing of the shifting operation (in one or moreiterations), the computed luminance values for all the pixels (whethercomputed on a per-pixel basis or on a per-cell or cells-group basis) canbe used to convert the temporary image to a desired colorrepresentation, and the temporary image can be copied to give rise to anoutput image.

Optionally, as part of examples of the presently disclosed subjectmatter, the resulting output image can be scanned and the readablematrix code that is represented by the output image can be decoded toobtain the message that was encoded into the output image (block 350).

Reference is now made to FIG. 6, which is a flowchart illustration of amethod of generating a readable matrix code representation, according toexamples of the presently disclosed subject matter. In FIG. 6, inaddition to the blocks shown in FIG. 3 and which were described inlength above with reference to FIG. 3, the fusing process includesimplementing a saliency criterion to determine a portion of the inputimage to which the matrix code is to be applied (block 622). Asmentioned already above, in some examples of the presently disclosedsubject matter, the readable matrix code representation can be generatedfor only a portion of the input image. In such cases, by way of example,a saliency criterion can be used to determine which portion of theoriginal image should be taken as the input image that is processed andreplaced or fused with a readable matrix code representation that isgenerated based on the teachings provided herein. It would beappreciated that a saliency criterion is merely one example of acriterion that can be used for determining which portion of the originalimage should be used as the input image to be processed and replaced orfused with a readable matrix code representation according to examplesof the presently disclosed subject matter.

Furthermore, in FIG. 6, in addition to the blocks shown in FIG. 3 andwhich were described above with reference to FIG. 3, the process ofselecting an extent of each of the free cells and the derived cellsincludes implementing a saliency criterion (block 630). In some examplesof the presently disclosed subject matter, the free cells selectionprocess further comprises a saliency criterion and uses the saliencycriterion to designate the free cells. For example, the cells or areaswhich are most salient from all possible cells can be chosen as the freecells.

Reference is now made to FIG. 7, which is a block diagram illustrationof a device for generating a readable matrix code representation image,according to examples of the presently disclosed subject matter. In FIG.7, in addition to the blocks shown in FIG. 1 and which were describedabove with reference to FIG. 1 and with further reference to FIG. 3, thedevice 700 can include a saliency evaluation module 702. By way ofexample, the saliency module 702 can be configured to implement asaliency criterion and saliency detection method to select a portion ofthe input image that is to be processed by the device 702, forgenerating a corresponding readable matrix code.

Reference is now made to FIG. 8, which is a flowchart illustration of amethod of generating a readable matrix code representation, according toexamples of the presently disclosed subject matter. In FIG. 8, inaddition to the blocks shown in FIG. 3 and which were described atlength above with reference to FIG. 3, the fusing process includesdesignating a portion of the free cells as selected cells (block 832).As mentioned above, the free cells are cells that can receive any validvalue according to the readable matrix code specification, and inexamples of the presently disclosed subject matter, the values for thefree cells are determined based on a visual perceptual similarity to aninput image, and specifically by way of example, so as to provide anoptimal level of similarity to the input image.

According to examples of the presently disclosed subject matter, theselected cells are specific cells that are selected from amongst thefree cells. According to examples of the presently disclosed subjectmatter, the selected cells can be selected using a saliency criterion.Still further by way of example, a region of certain (e.g., predefined)dimension can be selected using the saliency criterion. Still further byway of example, the region that is selected can be the one that is leastsalient among the region that is associated with the free cells.However, in other examples, the selected cells can be selected in adifferent way, for example, the selected cells can be selected manuallyby an operator.

Still further by way of example, for the selected cells the values arecalculated differently from the other free cells. According to examplesof the presently disclosed subject matter, the values for the selectedcells can be obtained based on the range of valid values for free cellsset forth in the code word specification (block 837). The values for theselected cells can be obtained further based on a predefined messagethat is to be encoded in the selected cells. According to examples ofthe presently disclosed subject matter, the values which are obtainedfor the selected cells do not necessarily provide the optimal, or even ahigh level, of visual perceptual similarity to respective areas of theinput image. Still further according to examples of the presentlydisclosed subject matter, as opposed to free cells, perceptualsimilarity can be disregarded when the values for the selected cells areobtained. Yet further by way of example, visual perceptual similarity ofthe selected cells (or of the values for the selected cells) can beevaluated during the fusing operation (block 842), in a manner that issimilar to what was described above with reference to FIG. 3 and toFIGS. 4 and 5. In yet further examples of the presently disclosedsubject matter, visual perceptual similarity of the selected cells canbe evaluated to some extent when the values for the selected cells areobtained at block 837, and this evaluation can be in addition to theimplementation of the visual perceptual similarity measures in thefusing operation in block 842.

According to further examples of the presently disclosed subject matter,the values for the selected cells provide a predefined message whendecoded. Thus, according to examples of the presently disclosed subjectmatter, the values for the selected cells can be based on the validrange for free cells set forth in the code word specification, and basedon a predefined reference of prefix of a reference. In yet a furtherexample, the values for the selected cells can be selected from amongsta set of predefined references or from a set of predefined prefixes.Still further by way of example, the selection of the reference or theprefix can be made according to a visual perceptual similarity measure.Thus for example, the reference or prefix for which the values for theselected cells provide the best visual perceptual similarity to thecorresponding area of the input image is selected and used forgenerating the corresponding region of the readable matrix code.

According to examples of the presently disclosed subject matter, thepredefined message with which the selected cells are associated is areference to a network resource, such as a URL of a network resource.Still further by way of example, the selected cells provide a prefix ofa URL address, and the full URL is a combination of the prefix encodedinto the selected cells and the values which are calculated for the freecells. Yet further by way of example, the message encoded in the freecells is a key to a specific resource in a network domain or in acertain area within a network domain that is referenced in the selectedcells.

Referring now to FIG. 9, there is shown a graphical illustration of aprocess of generating a readable matrix code representation based on theFacebook® logo, according to examples of the presently disclosed subjectmatter. The Facebook® logo is a registered trademark of Facebook Inc. Asis shown in FIG. 9, the Facebook® logo can serve as the input image 910in a process of generating a readable matrix code representationaccording to examples of the presently disclosed subject matter. Inaddition to the input image 910 a readable matrix code representation905 can be provided as input. It would be appreciated that the matrixcode representation can be preloaded or hardcoded in some examples ofthe presently disclosed subject matter.

According to examples of the presently disclosed subject matter, in theimplementation of the process of generating a readable matrix code shownin FIG. 9, and described herein, initially decode input values arecalculated for the function patterns, selected cells, free cells andderived cells, and subsequently the values for the various cells thatare used for generating the output image (or the readable matrix coderepresentation) are calculated, based on, inter-alia, the calculateddecode input values.

According to examples of the presently disclosed subject matter, as partof the process of generating a readable matrix, and as was describedabove, function patterns and cells can be computed (block 915). By wayof example, block 915 shows a state of a temporary readable matrix codeafter the computation of the function patterns.

Further by way of example, at block 920, the temporary image includesdecode input values for the function patterns and for the selectedcells. As mentioned above, the selected cells are selected from the freecells and are used to encode a certain message, for example, a prefix,which by way of example, can be used together with the free cells toform a unique network resource address.

At block 920, the decode input values for the free cells are computed.As can be seen from FIG. 9, the process of generating a readable matrixcode according to examples of the presently disclosed subject matter,can take into account in the computation of the decode input values forthe free cells a visual similarity to the respective areas in the inputimage, so as to provide a relatively high level of visual perceptualsimilarity among certain areas of the input image and correspondingareas in the temporary image (and later in the output image).

At block 925, the decode input values for the derived cells are computedand added to the temporary image.

At block 930, the values for the free cells, the values for the selectedcells and the values for the derived cells, and specifically for thepixels associated with each of these cells are computed, and the outputimage is generated. The output image is readable matrix coderepresentation which can be scanned and processed to provide a validreadable matrix code. As mentioned above, in this case, the readablematrix code representation encodes a certain prefix (e.g, a domain name)and a certain substantially unique key, which together can be used toaccess a certain network resource (e.g., via an Internet address).

Referring now to FIG. 10, there is shown a graphical illustration of aprocess of generating a readable matrix code representation based on theFacebook® logo, according to examples of the presently disclosed subjectmatter. The Facebook® logo is a registered trademark of Facebook Inc.The process shown in FIG. 10 uses the same input image 910 (theFacebook® logo) and the same readable matrix code specification 905 asin FIG. 9. Values for the function patterns and cells and values for theselected patterns and cells for the readable matrix code in FIG. 10 arecalculated or provided in the same manner as was described above withreference to FIG. 9. The difference between FIG. 10 and what is shown inFIG. 9, and described above with reference to FIG. 9, is that the freecells in block 1025 include data cells and error correction cells, andthe derived cells include data cells and error correction cells, whereasin FIG. 9 the free cells are only data cells. A description of animplementation of the process of generating a readable matrix codewherein the free cells include data cells and error correction cells,was described above and can be used to generate the readable matrix codepresented in block 1025. Further according to examples of the presentlydisclosed subject matter, a fusing process can be implemented to producethe readable matrix code representation shown in block 1030.

It should be appreciated that the pixels of the readable matrix coderepresentation can have color values which are visual perceptuallysimilar to the color values of corresponding pixels of the input image,for example, different shades of blue for the Facebook® logo image (theInput image 910), which is predominately blue, where the differentshades represent dark/light decode input values of a QR-Code, forexample according to the luminosity value of the different shades ofblue. It would be further appreciated that the values that arecalculated for the free cells, for the derived cells, and for thefunction patterns in accordance with examples of the method ofgenerating a readable matrix code presented herein, can representdifferent colors and color shades which are visually perceptuallysimilar to corresponding areas of the input image, the colors and shadescomputed for the derived cells, and for the function patternsrepresenting dark/light decode input values of a readable matrix codespecification (e.g., QR-Code), for example according to the luminosityvalue of the different shades or colors represented by the calculatedvalues. It would be appreciated that the above is applicable also toother types of cells for which values are computed according to theexamples of the method of generating a readable matrix code describedherein, including for example selected cells, version cells, metadatacells and padding cells.

It will also be understood that the system according to the inventionmay be a suitably programmed computer. Likewise, the inventioncontemplates a computer program being readable by a computer forexecuting the method of the invention. The invention furthercontemplates a machine-readable memory tangibly embodying a program ofinstructions executable by the machine for executing the method of theinvention.

The invention claimed is:
 1. A computerized method of generating areadable two-dimensional code encoding an input message and embeddingadditional information recognizable by a human eye from an input image,the two-dimensional code including function patterns and cells, themethod comprising: calculating the function patterns; and calculatingdecoded values for the cells based on at least the encoded message inaccordance with the additional information, such that an appearance of aportion of the cells in the two-dimensional code is visual perceptuallysimilar to the additional information from the input image.
 2. Thecomputerized method according to claim 1, wherein the additionalinformation recognizable by a human eye includes a logo.